How to find tagIds by using their label

How to find tagIds by using their label

Requirements

To find the ID of a tag by knowing only its label, you can use the itagdefinition/list web service. The requirements for using this service are:

  • The token used must correspond to a user with the permission to view the tags in the specific classification.
  • You need to know the id of the classification.

 

Retrieve the classification ID

To retrieve the classification ID you must use the classification/list web service. By providing the classification type (TARGET, TOPIC, or CUSTOM) you will obtain its id in the response.

The url of the request is structured as follows:

//[clientId]-view.thron.com/api/xintelligence/resources/classification/list/[clientId]

 In the header of the request, which is a POST request, make sure to include the following information:

  • X-TOKENID: the token of a user with the permission to view the tags in the classification

In the body of the request you can paste the following JSON, filling required parameters:

{
  "criteria": {
    "active": true,
    "removed": false,
    "classificationType": [
      "<Put classification type here>"
    ]
  }
}

Where classificationType can either be "TOPIC", "TARGET" or "CUSTOM".

In the response, you will get the id parameter which is the actual ID of the classification.

 

Retrieve the tagId

Now that you have the classification ID you can use it along with the tag's label to get its ID via itagdefinition/list request.

The url of the request is structured as follows:

//[clientId]-view.thron.com/api/xintelligence/resources/itagdefinition/list/[clientId]/[classificationId]

In the headers of the request, which is a POST request, make sure to include the following information:

  • X-TOKENID: the token of a user with the permission to view the tags in the classification

In the body of the request you can paste the following JSON, filling required parameters:

{
    "criteria": {
        "categorized": true,
        "text": "<Put tag label here>",
        "lang": "IT,EN"
    },
    "showLinkedMetadata": false,
    "orderBy": "label_A"
}

Where:

  • categorized: (boolean, optional, default false) use this parameter to filter among categorized tags and tags created by the semantic engine. If set to true, the service will return only tags in the organized tree. Tags created by the semantic engine are initially non-categorized.
  • text: (string, optional) the actual label of the tag you are looking for.
  • lang: (string, optional) the languages you want to use to perform the search. Could be a single locale or a comma separated list (ISO639-1).
  • showLinkedMetadata: (boolean, optional, default true) if true, the service will also return for each tag all the linked metadata.
  • orderBy: (string, optional) the sorting preference of the response. Available values are:
    • label_A (default): ascending alphabetical order by tag's name
    • label_D: descending by alphabetical order by tag's name
    • createdDate_A: ascending order by creation date
    • createdDate_D: descending order by creation date
    • pos_A: ascending order by position in the tree
    • pos_D: descending order by position in the tree

In the response you will get an object for each matching tag, and for each one of them you will get the "id" parameter which is the actual tagId.

Was this article helpful?
0 out of 0 found this helpful

Have more questions?

SUBMIT A REQUEST

Hai altre domande?

INOLTRA UNA RICHIESTA

Comments