Create Tag

DESCRIPTION

To create a tag on a set of metrics that match a search expression.

Multiple expressions can be associated to each tag which is treated an OR expression between them.

 Note: It can take up to 20 minutes till the metric tagging operation will be applied to the relevant metrics.  

IMPORTANT
1. If a tag already exists then the tag will be removed from metrics that previously matched the search expression. The tag will be added only to the metrics that match the current search expression.
2. Tags MUST NOT contain the following characters:{ . SPACE}

DEFINITION

POST  https://api.anodot.com/api/v1/metrics/tags?token=<api token>

HEADERS

Content-type=application/json

BODY

{
"tag": {
    "key": "tagName",
  "value": "tagValue"
  },
  "expressions": [
    {
      "expression": [
        {
          "type": "property",
          "key": "key1",
          "value": "val1"
      },
      {
          "type": "property",
          "key": "key2",
          "value": "val2"
      }
     ]
    },
    {
      "expression": [
        {
          "type": "property",
          "key": "key1",
          "value": "val3"
        },
        {
          "type": "property",
          "key": "key2",
          "value": "val4"
        }
      ]
    }
  ]
}

 ARGUMENT\ DEFINITION

tag

key: tag key name

value: tag key value

expressions

Array of expressions, each expression can contain several metrics queries.

type: the type of the search expression, can be of type [search] or [property] (recommended).

key: the metric key name

value: the metric key value 

in the above example all metrics return from the query :

((key1 == val1) AND (key2 == val2)) OR ((key1 ==val3) AND (key2 ==val4)) 

 will be tagged with the tag: tagName:tagValue

 EXAMPLE REQUEST

curl \
-X POST \
-d '{"tag":{"key":"my_campaigns","value":"12345678ABC"},"expressions":[{"expression":[{"type":"property","key":"what","value":"impressions"},{"type":"property","key":"campaign_id","value":"12345678ABC"}]}]}' \
-H "Content-Type: application/json" \
'https://api.anodot.com/api/v1/metrics/tags?token=<api token>'

EXAMPLE RESPONSE

{
   "validation":{
      "passed":true,
      "failures":[

      ]
   },
   "tags":[
      {
         "id":"8b6f6fa8-ba46-4596-8358-ebcb4727f5ee",
         "expressions":[
            {
               "expression":[
                  {
                     "type":"property",
                     "key":"what",
                     "value":"impressions"
                  },
                  {
                     "type":"property",
                     "key":"campaign_id",
                     "value":"12345678ABC"
                  }
               ]
            }
         ],
         "tag":{
            "key":"my_campaigns",
            "value":"12345678ABC"
         }
      }
   ]
}

Note: For more details about example responses, see Success and Errors

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