How to manage contexts

As illustrated in this article, Context is a special lable which will help you identify all trackings coming from a specific context of use of your content, such as website, mobile application or any other integration. Context can be managed by users with the specific administrative permission to manage context.

Each context is uniquely identified by a contextId, which will be provided after its creation and which has to be used for all the subsequent requests (update, remove). Additionally, each context can be enriched with further information such as a label and a description, these will be useful when analyzing statistics because they will help you identify all different conexts. In order to create a new context you can use the insert web service which is included in the context package of xintelligence. In the body of the request you can paste the following JSON, filling required parameters:

{
    "value": {
        "names": [{
            "lang": "",
            "label": "",
            "description": ""
        }]
    }
}

In order to update an already existing context you can use the update web service. In the header of the request, along with the clientId and the token, you will also have to provide the id of the context you want to update. The "update" field of this web service works in "patch" mode: it means that each and everyone of the "update" attributes you want to change (label or description) must be included in the body of the request, those not included will not be updated. In the body of the request you can paste the following JSON, filling required parameters:

{
    "update": {
        "names": [{
            "lang": "",
            "label": "",
            "description": ""
        }],
        "patch": [{
            "op": "",
            "field": ""
        }]
    }
}

The web service which must be used to delete a specific context is the remove. You will just have to provide the id of the context in the header of the request.

If you want to retrieve all the available contexts in your domain you can use the list web service. In the body of the request you can paste the following JSON, filling required parameters:

{
    "criteria": {
        "removed": false
    },
    "offset": 0,
    "limit": 0
}
Was this article helpful?
0 out of 0 found this helpful

Have any question?

Open a ticket
Comments