Integration Guide

To be able to use contextuad api you need to be signed up to the system. For more information please contact us.

Before going into the endpoints, remember to add your token to header of the request in the following format:

Headers:

Authorization = Bearer <YOUR TOKEN>

To get a token for accessing the data send your username and password information to https://apicntxad.reklamstore.com/token in a JSON format.

Example Request:

{

“username”: “YOUR USERNAME”,

“password”: “YOUR PASSWORD”

}

  • Also add Content-Type to the Headers as: Content-Type: application/json

Responses:

Our responses have three main parts which are status, message and data.

status

{1: successful, 0:failed}

message

System message

data

Retrieved data

 

Category

We are using 29 main categories from Interactive Advertising Bureau (IAB). To get the list of categories and category id’s send a GET request to https://apicntxad.reklamstore.com/category 

Python Code:

import requests

url = “https://apicntxad.reklamstore.com/category”

payload = “”

headers = {

    “Authorization”: “Bearer YOUR TOKEN”

}

response = requests.request(“GET”, url, data=payload, headers=headers)

print(response.json())

URL

The url page is designed by pagination technique which means you can get the content of it in pages. Reason for this choice is that the cache is updated every day and users can retrieve a small portion of the data instead getting thousands of urls.

Filters should be given as URL parameters such as:

https://apicntxad.reklamstore.com/url?category_id=15&page=1&size=10000&sort=desc

Parameters:

  • category_id [0 : 28] (required),
  • page = (required),
  • size = [1000 : 50000] (optional, default=50000),
  • sort = [desc, asc] (optional, default=desc)

Example Response:

{

“data”: {

“category_name”: “News_and_Politics”,

“last_updated”: “2023-09-26 16:52:22”,

“next_page”: “https://apicntxad.reklamstore.com/url?category_id=15&page=2&size=10000&sort=desc”,

“size”: 10000,

“sort”: “desc”,

“total_page”: 7,

“total_url”: 60428,

“urls”: [“url1”, “url2”, “url3”]

},

“message”: “success”,

“status”: 1

}

    • You may find out how many new urls added into the list by comparing the total_url value in your current and last response.
    • You may directly use the next_page value as your url for retrieving the next page.
  • next_page is set to None if it is the last page.

Python code for retrieving the first page:

 

import requests

headers = {

    “Authorization”: “Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InJzYWRtaW4iLCJ1c2VyX2lkIjoxLCJpc19hZG1pbiI6dHJ1ZSwiZXhwIjoxNjk1NzM5MjY3fQ.CBYU9shavaIrh0fkm_U5UOWE54uhI5ToATtifheRDRI”

}

init_url = “https://apicntxad.reklamstore.com/url?category_id=15&page=1&size=10000&sort=desc”

response = requests.request(“GET”, init_url, headers=headers)

response = response.json()

print(response[‘data’][‘next_page’])

print(len(response[‘data’][‘urls’]))