Targeting Template Requests

Get Usage Information for Targeting Templates

Method GET
URL https://api.videoplaza.com/api/2.0/targeting-template/usage
Header Authentication header (x-o-api-key)
Content type application/json
URL params -
Query params -
Body -
Success response

HTTP status: 200 OK

Header: -

Body:

{
  "active": "<integer>",
  "max": "<integer>",
  "messageTitle": "<string>", (Value provided after reaching template limit)
  "messageBody": "<string>"  (Information provided after reaching template limit)
}

Example:

Request header:

GET /api/2.0/targeting-template/usage HTTP/1.1
Host: api.videoplaza.com
Content-Type: application/json
x-o-api-key="<your key>"

Request body: NA

Success response:

HTTP status:
  200 (OK)

Body:
{
  "active": 5,
  "max": 10,
  "messageTitle": "",
  "messageBody": "" 
}

List Targeting Templates

Method GET
URL https://api.videoplaza.com/api/2.0/targeting-template
Header Authentication header (x-o-api-key)
Content type application/json
URL params -
Query params
  • campaignId: only lists templates linked to the corresponding campaign
  • goalId: only lists templates linked to the corresponding goal
Body -
Success response

HTTP status: 200 OK

Header: -

Body: list of targeting templates:

[
  {
    "id": "<string>",
    "name": "<string>",
    "siteId": "<string>",
    "created": "<date-time string>"
  },
  {
    "id": "<string>",
    "name": "<string>",
    "siteId": "<string>",
    "created": "<date-time string>"
  }
]

Example:

Request header:

GET /api/2.0/targeting-template HTTP/1.1
Host: api.videoplaza.com
Content-Type: application/json
x-o-api-key="<your key>"

Request body: NA

Success response:

HTTP status:
    200 (OK)

Body:
[
  {
    "id": "053a4218-87c1-491d-83ac-6136abf0a866",
    "name": "Frequency capping 5",
    "siteId": "<id of your site>",
    "created": "2016-03-22T14:34:40.000+0000"
  },
  {
    "id": "fef506b4-d304-4bfc-986c-40a0b30155b1",
    "name": "Geotargeting-Volvo",
    "siteId": "<id of your site>",
    "created": "2016-03-22T14:33:22.000+0000"
  },
  {
    "id": "b0fd3da7-8452-456c-9642-99e34253f0de",
    "name": "Local",
    "siteId": "<id of your site>",
    "created": "2016-03-14T15:17:29.000+0000"
  },
  {
    "id": "4903058d-8a06-4ba1-b74d-16dcf3c134e9",
    "name": "Mobile",
    "siteId": "<id of your site>",
    "created": "2016-03-21T10:28:08.000+0000"
  },
  {
    "id": "f940b752-bdce-44d1-9917-072a2863f7cc",
    "name": "Sport",
    "siteId": "<id of your site>",
    "created": "2016-03-14T15:16:48.000+0000"
  }
]

Example:

Request header:

GET /api/2.0/targeting-template?campaignId=f7dacaa0-e3af-4f0e-b29d-87152a8c3cc5 HTTP/1.1
Host: api.videoplaza.com
Content-Type: application/json
x-o-api-key="<your key>"

Request body: NA

Success response:

HTTP status:
    200 (OK)

Body:[
  {
    "id": "053a4218-87c1-491d-83ac-6136abf0a866",
    "name": "Frequency capping 5",
    "siteId": "<id of your site>",
    "created": "2016-03-22T14:34:40.000+0000"
  }
]

Get Information About a Targeting Template

Method GET
URL https://api.videoplaza.com/api/2.0/targeting-template/{id}
Header Authentication header (x-o-api-key)
Content type application/json
URL params ID of the targeting template
Query params -
Body -
Success response

HTTP status: 200 OK

Header: -

Body:
{
  "id": "<string>",
  "name": "<string>",
  "siteId": "<string>",
  "created": "<date-time string>"
}

Example:

Request header:

GET /api/2.0/targeting-template/053a4218-87c1-491d-83ac-6136abf0a866 HTTP/1.1
Host: api.videoplaza.com
Content-Type: application/json
x-o-api-key="<your key>"

Request body: NA

Success response:

HTTP status:
    200 (OK)
 
Body:
{
  "id": "053a4218-87c1-491d-83ac-6136abf0a866",
  "name": "Frequency capping 5",
  "siteId": "<id of your site>",
  "created": "2016-03-22T14:34:40.000+0000"
}

Create New Targeting Template

Method POST
URL https://api.videoplaza.com/api/2.0/targeting-template
Header Authentication header (x-o-api-key)
Content type application/json
URL params -
Query params -
Body
{
  "name": "<string>" (The name of the targeting template)
}
Success response

HTTP status: 200 OK

Header: -

Body:
{
  "id": "<string>",
  "name": "<string>",
  "siteId": "<string>",
  "created": "<date-time string>"
}
Note: This creates an empty template. To set the rules of a template, you need to do a PUT request. For more information and examples, see Targeting Template Rules Requests.

Example:

Request header:

POST /api/2.0/targeting-template HTTP/1.1
Host: api.videoplaza.com
x-o-api-key="<your key>"
Content-Type: application/json
Content-Length: 24

Request body:

{
"name": "New template"
}

Success response:

HTTP status:
    200 (OK)
 
Body:
{
  "id": "08865183-b228-4d47-aa8f-ca00a6ba54a6",
  "name": "New template",
  "siteId": "<id of your site>",
  "created": "2016-06-23T10:21:13.007+0000"
}
Note: If you have already reached the maximum number of targeting templates and try to create a new template, you see the following:

Success response:

HTTP status:
  403 (Forbidden)

Body:
{
  "type": "ForbiddenError",
  "message": "You have used 5 (100%) of your 5 templates. Please remove obsolete templates in order to create new ones."
}

Update Targeting Template

Method PUT
URL https://api.videoplaza.com/api/2.0/targeting-template/{id}
Header Authentication header (x-o-api-key)
Content type application/json
URL params ID of the targeting template
Query params -
Body
Note: Only the name of the targeting template can be changed.
{
  "id": "<string>", (The id of the targeting template you want to update)
  "name": "<string>", (The new name of the targeting template)
  "siteId": "<string>" (The ID of your site)
}
Success response

HTTP status: 204 No Content

Header: -

Body: -

Example:

Request header:

PUT /api/2.0/targeting-template/08865183-b228-4d47-aa8f-ca00a6ba54a6 HTTP/1.1
Host: api.videoplaza.com
Content-Type: application/json
x-o-api-key="<your key>"

Request body:

{
  "id": "08865183-b228-4d47-aa8f-ca00a6ba54a6",
  "name": "My new targeting template",
  "siteId": "<id of your site>"
}

Success response:

HTTP status:
    204 (No Content)

Delete Targeting Template

Method DELETE
URL https://api.videoplaza.com/api/2.0/targeting-template/{id}
Header Authentication header (x-o-api-key)
Content type application/json
URL params ID of the targeting template
Query params -
Body -
Success response

HTTP status: 204 No Content

Header: -

Body: -

Example:

Request header:

DELETE /api/2.0/targeting-template/08865183-b228-4d47-aa8f-ca00a6ba54a6 HTTP/1.1
Host: api.videoplaza.com
Content-Type: application/json
x-o-api-key="<your key>"

Request body: NA

Success response:

HTTP status:
    204 (No Content)

Was this article helpful?