Tags

A tag is a label used to group persons

People Tags

People tags are objects that exist on the account level and can be added to any person.
Multiple tags can be added to one person. Each Tag can contain several people.

A tag becomes handy when you want to group all persons according to a specific interest or attribute (i.e., you want to tag all persons with the label "Electronics Wishlist" who added items from the electronics category to their wishlist to send them a campaign with special electronics offers later).

Tag methods

View also Person and Custom Attribute.

Resource

https://api.infobip.com/people/2/tags

Model

UNIQUE IDENTIFIER

Each tag can be addressed by name. Name is case-insensitive and must be unique in the system which means that one cannot be assigned to multiple tags. To address particular tag you need to use URL encoded name

Parameter Type Description Limits
createdAt string date and time when a tag was created returned in method response -
modifiedAt string date and time when a tag was modified returned in method response -
name string tag name 256 characters max

Methods details

Create new tag

Use this method to create a new tag:

Request:

POST /people/2/tags HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/json

{  
   "name":"All Customers"
}

Response:

{
    "createdAt": "2017-12-27T15:22:47",
    "modifiedAt": "2017-12-27T15:22:47",
    "name": "All Customers"
}
{
    "value": 40002,
    "message": "Duplicate"
}

Duplicate tags handling

If you try to create a tag with a name that already exists in the system, you will get the following response:

{
    "value": 40002,
    "message": "Duplicate"
}

Get single tag

Use this method to get a single tag:

Request:

GET /people/2/tags/all%20customers HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/json

Response:

{
    "createdAt": "2017-12-27T15:22:47",
    "modifiedAt": "2017-12-27T15:22:47",
    "name": "All Customers"
}

Get list of tags

Use this method to get a list of tags with pagination:

Parameter Type Description
limit int If a limit count is given, no more than that many rows will be returned (but possibly less, if the query itself yields fewer rows). The default value is 100.
page int This parameter says to skip that many rows before beginning to return rows. If both *page *and *limit *appear, then page rows are skipped before starting to count the limit rows that are returned. The default value is 1.
orderBy string This parameter is used to order your results. If an order is not given, the default order name:asc will be applied. Possible ordering fields are name, createdAt and modifiedAt. Ordering direction can be specified with modifiers asc for the ascending ordering or desc for the descending one.

Request:

GET /people/2/tags HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/json

Response:

{
    "tags": [
        {
            "createdAt": "2019-02-25T12:46:06",
            "modifiedAt": "2019-02-25T12:46:06",
            "name": "All customers"
        },
        {
            "createdAt": "2019-02-25T12:47:03",
            "modifiedAt": "2019-02-25T12:47:03",
            "name": "Loyal customers"
        },
        {
            "createdAt": "2019-02-25T13:15:20",
            "modifiedAt": "2019-02-25T13:15:20",
            "name": "VIP customers"
        },
        {
            "createdAt": "2019-02-25T13:15:27",
            "modifiedAt": "2019-02-25T13:15:27",
            "name": "Old customers"
        },
        {
            "createdAt": "2019-02-25T13:15:30",
            "modifiedAt": "2019-02-25T13:15:30",
            "name": "New customers"
        }
    ],
    "limit": 100,
    "page": 1,
    "orderBy": "name:asc"
}

You can specify limit, page and orderBy to get tags you want:

Request:

GET /people/2/tags?limit=2&page=3&orderBy=modifiedAt:desc&includeTotalCount=true HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/json

Response:

{
    "tags": [
         {
            "createdAt": "2019-02-25T13:15:27",
            "modifiedAt": "2019-02-25T13:15:27",
            "name": "Old customers"
        },
        {
            "createdAt": "2019-02-25T13:15:20",
            "modifiedAt": "2019-02-25T13:15:20",
            "name": "VIP customers"
        }
    ],
    "limit": 2,
    "page": 3,
    "totalCount": 11,
    "orderBy": "modifiedAt:desc"
}

Include total count

Add &includeTotalCount=true as a parameter to get a total count together with a list of tags.

Delete tag

Use this method to delete the tag:

Request:

DELETE /people/2/tags/All%20customers HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/json

Response:

{
    "errorCode": 40403,
    "errorMessage": "Tag does not exist"
}

Deleting a tag which doesn't exist

If you try to delete a tag which does not exist, you will get the following response:

{
    "errorCode": 40403,
    "errorMessage": "Tag does not exist"
}

Add tag to people

Use this method to add tag to the list of people. If tag is absent it will be created. The maximum number of people in the batch is 1000.

Request:

PATCH /people/2/tags/Vip%20Black/persons HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/json

{
   "people": [
      {
         "query": {
            "email": "janesmith@acme.com"
         }
      },
      {
         "query": {
            "phone": "41793026727"
         }
      },
      {
         "query": {
            "externalId": "1"
         }
      }
   ]
}

Response:

Remove tag from people

Use this method to remove tag from the list of people. The maximum number of people in the batch is 1000.

Request:

DELETE /people/2/tags/Vip%20Black/persons HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/json

{
   "people": [
      {
         "query": {
            "email": "janesmith@acme.com"
         }
      },
      {
         "query": {
            "phone": "41793026727"
         }
      },
      {
         "query": {
            "externalId": "1"
         }
      }
   ]
}

Response:

{
    "errorCode": 40403,
    "errorMessage": "Tag does not exist"
}