Segments

Segments

Access to segments is provided to all users who have the appropriate permission in their personal account.
For getting information about segments, the following requests are provided:

The list method allows you to get a list of the segments

Request:

{site_path}/{lang}/api/segment/list

GET parameters list:

filter array Allows filtering data by all available fields
fields string Allows to select only the specified fields from all available
sort string Allows you to sort asc and desc entities by all available fields
page int Allows you to pass the page number of the list of entities

List of all available fields

id int Segment ID
name string Segment name
format int Segment size
userID int User ID
typeID int Segment type ID
assignID int ID of the user responsible for the segment
created_by int Segment creator's ID
updated_by int ID of the last user who edited the segment
created_at int UTC segment creation time
updated_at int UTC last edit time
typeName string Segment type
userName string Segment user name
clicks int Total clicks
clicksToday int Clicks for the current day
clicksYtd int Clicks over the past day
views int Total views
viewsToday int Views for the current day
viewsYtd int Views over the past day
active boolean Segment status
Values:
  • 1 - enabled
  • 0 - disabled
tag array Tags

Response

The response is transmitted in JSON format. List of response fields:

result array List of superpools based on query parameters
_links array List of navigation links. May contain the following elements:
  • self - contains a link to the current page of the list
  • first - contains a link to the first page of the list
  • last - contains a link to the last page of the list
  • prev - contains a link to the previous page of the list
  • next - contains a link to the next page of the list
_meta array Information on list navigation. Contains elements:
  • totalCount - total number of available entities considering all selected parameters
  • pageCount - the sequence number of the entity in the list that starts the current page
  • currentPage - number of the current page
  • perPage - number of entities displayed on one page

Request example:

{site_path}/{lang}/api/segment/list?filter[id][in][]=1992642262&filter[id][in][]=1461361335&sort=name

Response example:

{
  "result": [
    {
      "id": 1992642262,
      "name": "another segment name",
      "format": 0,
      "userID": 1976690250,
      "typeID": 4,
      "assignID": 0,
      "created_by": 907,
      "created_at": 1580204454,
      "updated_by": 907,
      "updated_at": 1580204454,
      "typeName": "window",
      "userName": "user name",
      "views": "0",
      "viewsToday": "0",
      "viewsYtd": "0",
      "clicks": "14",
      "clicksToday": "14",
      "clicksYtd": "0",
      "active": "1",
      "tag": {
        "1": "sport",
        "2": "general"
      }
    },
    {
      "id": 1461361335,
      "name": "segment name",
      "format": 131,
      "userID": 1745160257,
      "typeID": 2,
      "assignID": 0,
      "created_by": 903,
      "created_at": 1588933547,
      "updated_by": 903,
      "updated_at": 1592314660,
      "typeName": "banner",
      "userName": "user name",
      "views": "0",
      "viewsToday": "0",
      "viewsYtd": "0",
      "clicks": "0",
      "clicksToday": "0",
      "clicksYtd": "0",
      "active": "1",
      "tag": {
        "2": "general"
      }
    }
  ],
  "_links": {
    "self": {
      "href": "{site_path}/{lang}/api/segment/list?filter%5Bid%5D%5Bin%5D%5B0%5D=1461361335&filter%5Bid%5D%5Bin%5D%5B1%5D=1992642262&sort=name&page=1"
    }
  },
  "_meta": {
    "totalCount": 2,
    "pageCount": 1,
    "currentPage": 1,
    "perPage": 20
  }
}

The view method provides extended information about the segments

Request:

{site_path}/{lang}/api/segment/view/[id]

GET parameters list:

id int It is a required parameter. Segment nubmer
fields string Allows to select only the specified fields from all available
*Does not apply to related entity fields

List of all available fields

id int Segment ID
name string Segment name
format int Segment size
userID int User ID
typeID int Segment type ID
assignID int ID of the user responsible for the segment
created_by int Segment creator's ID
updated_by int ID of the last user who edited the segment
created_at int UTC segment creation time
updated_at int UTC last edit time
typeName string Segment type
userName string Segment user name
clicks int Total clicks
clicksToday int Clicks for the current day
clicksYtd int Clicks over the past day
views int Total views
viewsToday int Views for the current day
viewsYtd int Views over the past day
active boolean Segment status
Values:
  • 1 - enabled
  • 0 - disabled
auction array Auctions
May contain:
pool array Pools related to the segment
May contain:
tag array Tags

Request example:

{site_path}/{lang}/api/segment/view/1518505651

Response example:

{
  "id": 1518505651,
  "name": "segment name",
  "format": 0,
  "userID": 1968035714,
  "typeID": 1,
  "assignID": 0,
  "created_by": 1660984908,
  "created_at": 1553596136,
  "updated_by": 1839588080,
  "updated_at": 1577730166,
  "typeName": "banner",
  "userName": "user name",
  "views": "0",
  "viewsToday": "0",
  "viewsYtd": "0",
  "clicks": "0",
  "clicksToday": "0",
  "clicksYtd": "0",
  "active": null,
  "auction": [
    {
      "type": "campaign",
      "id": "1412628039",
      "name": "campaign name",
      "userID": "1968035714",
      "assignID": "903",
      "chain": "0",
      "priority": "1",
      "views": "7074360952",
      "viewsToday": "2762923",
      "viewsYtd": "7506117",
      "clicks": "40770194",
      "clicksToday": "23555",
      "clicksYtd": "64091",
      "attach_created_by": "1660984908",
      "attach_updated_by": "903",
      "attach_created_at": "1553596178",
      "attach_updated_at": "1591191620",
      "attached": "1",
      "active": "1"
    },
  ],
  "pool": [
    {
      "type": "super-pool",
      "id": "1225878269",
      "name": "suprepool name",
      "active": "1",
      "attached": "1",
      "chain": "0",
      "priority": "1",
      "views": "67815982",
      "viewsToday": "0",
      "viewsYtd": "0",
      "clicks": "428706",
      "clicksToday": "0",
      "clicksYtd": "0",
      "created_by": "1214768575",
      "updated_by": "1214768575",
      "created_at": "1530824611",
      "updated_at": "1530824611",
      "attach_created_by": "1660984908",
      "attach_updated_by": "1660984908",
      "attach_created_at": "1553596136",
      "attach_updated_at": "1553596136"
    },
  ],
  "tag": [
    {"id": 1, "name": "sport"},
    {"id": 2, "name": "general"},
  ]
}