Tag

A tag is a label used to group persons.

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 in order to send them a campaign with electronics special offers later).

People Tags

 

On this page you will learn how to insert, list and delete your tags.

Tag methods:

View also Person and Additional Field.

Resource

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

Resource description

Parameter Type Description
id string unique key of a tag returned in method response
createdAt string date and time when tag was created returned in method response
modifiedAt string date and time when tag was modified returned in method response
name string tag name

Create new tag

Use this method to create a new tag:

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

{  
   "name":"All Customers"
}
POST /people/1/tags HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/xml

<?xml version="1.0" encoding="UTF-8" ?>
<name>All Customers</name>

Response:

{
    "id": "E83E787CF2613450157ADA3476171E3F",
    "createdAt": "2017-12-27T15:22:47",
    "modifiedAt": "2017-12-27T15:22:47",
    "name": "All Customers"
}
<?xml version="1.0" encoding="UTF-8" ?>
<id>E83E787CF2613450157ADA3476171E3F</id>
<createdAt>2017-12-27T15:22:47</createdAt>
<modifiedAt>2017-12-27T15:22:47</modifiedAt>
<name>All Customers</name>

Duplicate tags handling

Each tag name must be unique in the system, names are case-insensitive. 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 according to the id:

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

Response:

{
    "id": "E83E787CF2613450157ADA3476171E3F",
    "createdAt": "2017-12-27T15:22:47",
    "modifiedAt": "2017-12-27T15:22:47",
    "name": "All Customers"
}
<?xml version="1.0" encoding="UTF-8" ?>
<id>E83E787CF2613450157ADA3476171E3F</id>
<createdAt>2017-12-27T15:22:47</createdAt>
<modifiedAt>2017-12-27T15:22:47</modifiedAt>
<name>All Customers</name>

List all tags 

List all tags using this method:

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

Response:

{
   "limit":20,
   "page":1,
   "orderBy":"modifiedAt:desc",
   "tags":[
      {
         "id":"E83E787CF2613450157ADA3476171E3F",
         "createdAt":"2017-12-27T15:22:47",
         "modifiedAt":"2017-12-27T15:22:47",
         "name":"All Customers"
      },
      {
         "id":"DB8900EDF5A28CA22130EAD25B98C13F",
         "createdAt":"2018-03-29T12:53:17",
         "modifiedAt":"2018-03-29T12:53:17",
         "name":"VIP Customers"
      }
   ]
}
<?xml version="1.0" encoding="UTF-8" ?>
<limit>20</limit>
<page>1</page>
<orderBy>modifiedAt:desc</orderBy>
<tags>
    <id>E83E787CF2613450157ADA3476171E3F</id>
    <createdAt>2017-12-27T15:22:47</createdAt>
    <modifiedAt>2017-12-27T15:22:47</modifiedAt>
    <name>All Customers</name>
</tags>
<tags>
    <id>DB8900EDF5A28CA22130EAD25B98C13F</id>
    <createdAt>2018-03-29T12:53:17</createdAt>
    <modifiedAt>2018-03-29T12:53:17</modifiedAt>
    <name>VIP Customers</name>
</tags>

Filter tags

Additionally, you can get tags according to any filter you want. Simply add URL encoded filter parameters to your method.

List of supported logical operators:

Logical Operator Description
#and Joins query clauses with a logical AND returns all records that match the conditions of both clauses.
#or Joins query clauses with a logical OR returns all records that match the conditions of either clause.

List of supported comparison operators:

Comparison Operator Supported Type Description
#eq string, integer, decimal, date Matches values that are equal to a specified value.
#ne string, integer, decimal, date Matches all values that are not equal to a specified value.
#contains string Matches the records that contain a specified value.
#startsWith string Matches the records that start with a specified value.
#endsWith string Matches the records that end with a specified value.
#gt integer, decimal, date Matches values that are greater than a specified value.
#lt integer, decimal, date Matches values that are less than a specified value.
#gte integer, decimal, date Matches values that are greater than or equal to a specified value.
#lte integer, decimal, date Matches values that are less than or equal to a specified value.

Paging and ordering

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 20.
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 modifiedAt:desc will be applied.

Example

Let’s say you want to filter all Tags that were created after (and including) March 20th 2018. In that case, this would be your JSON:

{  
   "#gte":{  
      "createdAt":"2018-03-20"
   }
}	
  

When you encode this filter, you will have a method like this:

GET /people/1/tags?filter=%7B%22%23gte%22%3A%7B%22createdAt%22%3A%222018-03-20%22%7D%7D HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/json
GET /people/1/tags?filter=%7B%22%23gte%22%3A%7B%22createdAt%22%3A%222018-03-20%22%7D%7D HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/xml

Response:

{
   "limit":20,
   "page":1,
   "orderBy":"modifiedAt:desc",
   "tags":[
      {
         "id":"E83E787CF2613450157ADA3476171E3F",
         "createdAt":"2017-12-27T15:22:47",
         "modifiedAt":"2017-12-27T15:22:47",
         "name":"All Customers"
      },
      {
         "id":"DB8900EDF5A28CA22130EAD25B98C13F",
         "createdAt":"2018-03-29T12:53:17",
         "modifiedAt":"2018-03-29T12:53:17",
         "name":"VIP Customers"
      }
   ]
}
<?xml version="1.0" encoding="UTF-8" ?>
<limit>20</limit>
<page>1</page>
<orderBy>modifiedAt:desc</orderBy>
<tags>
    <id>E83E787CF2613450157ADA3476171E3F</id>
    <createdAt>2017-12-27T15:22:47</createdAt>
    <modifiedAt>2017-12-27T15:22:47</modifiedAt>
    <name>All Customers</name>
</tags>
<tags>
    <id>DB8900EDF5A28CA22130EAD25B98C13F</id>
    <createdAt>2018-03-29T12:53:17</createdAt>
    <modifiedAt>2018-03-29T12:53:17</modifiedAt>
    <name>VIP Customers</name>
</tags>

Include total count

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

Delete tag

Use this method to delete a tag by id:

DELETE /people/1/tags/E83E787CF2613450157ADA3476171E3F HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/json
DELETE /people/1/tags/E83E787CF2613450157ADA3476171E3F HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/xml

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"
}