Creating ad spaces for partner networks

  • Before you start using an API for partner networks, ask the manager to add the subnetwork tag to your publisher account in Admitad.

  • To use the method, you need to obtain access_token. Auth Description.

  • In the parameter scope, send the right name “manage_websites.”

Parameters

HTTP method

Access rights

URL

Note

POST manage_websites https://api.admitad.com/subnetworks/v1/websites/create/
  • Request data format application/json

  • Returns the created ad space or validation errors info in the JSON format.

List of request parameters

In body, the request receives the list of json objects with the parameters of the ad space to be created.

Name

Type

Required

Settings restrictions

Note, allowed values

name string

Max length – 200

 
url string

Max length – 255

 
category array of integers
  Categories of affiliate programs
region array of strings
  Ad space regions
native_kind string
   

Example of a request for creating three 3 ad spaces

curl -i -L -H 'Authorization: Bearer ${ACCESS_TOKEN_HERE}' -H "Content-Type: application/json" -X POST http://api.admitad.loc/subnetworks/v1/create/ -d '[{ "name": "Test subnetwork with native 615125QCQ", "native_kind":"social_network", "url": "https://google1.com/", "region": ["RU","BY"]}, { "name": "Test subnetwork with native 623225QQC", "native_kind":"social_network", "url": "https://google1.com/", "region": ["UA", "GB"]}, { "name": "Test subnetwork with native 73135QCQ", "native_kind":"social_network", "url": "https://google1.com/", "category": [1,2,3], "region": ["US", "CN"]}]'

Example of a response after successful request processing

If the request was successfully processed, the response will be a json object with the created key, where the key is the index of the ad space specified in the request, and the value is the object of the created ad space.

HTTP/1.1 200 OK

{
  "0": {
    "status": "active",
    "kind": "subnetwork",
    "is_old": false,
    "account_id": "",
    "verification_code": "8dfcc8fec5",
    "creation_date": "2020-12-02T17:15:28",
    "id": 349022,
    "site_url": "https://google1.com/",
    "validation_passed": false,
    "name": "Test subnetwork with native 61",
    "is_lite": false
  },
  "1": {
    "status": "active",
    "kind": "subnetwork",
    "is_old": false,
    "account_id": "",
    "verification_code": "8c6210ac87",
    "creation_date": "2020-12-02T17:15:28",
    "id": 349023,
    "site_url": "https://google1.com/",
    "validation_passed": false,
    "name": "Test subnetwork with native 62",
    "is_lite": false
  },
  "2": {
    "status": "active",
    "kind": "subnetwork",
    "is_old": false,
    "account_id": "",
    "verification_code": "a82bdc1022",
    "creation_date": "2020-12-02T17:15:28",
    "id": 349024,
    "site_url": "https://google1.com/",
    "validation_passed": false,
    "name": "Test subnetwork with native 73",
    "is_lite": false
  }
}
Important:
  • If an invalid value is sent in the parameter for at least one of the partner network’s ad spaces, the request will not be processed, and none of the ad spaces will be created.

  • If ad spaces are successfully created, a scheduled task on connecting all the partner network’s created ad spaces to all affiliate programs the partner network’s main to which ad space is connected, will be created. It may take some time to connect the created ad spaces (usually, no longer than a couple of minutes).

Example of a response to an invalid request

The response will be a json object.

HTTP/1.1 400 Bad Request

{
  "0": {
    "name": [
      "У вас уже есть площадка с таким названием"
    ]
  },
  "1": {
    "name": [
      "У вас уже есть площадка с таким названием"
    ]
  },
  "2": {
    "name": [
      "У вас уже есть площадка с таким названием"
    ]
  }
}

Example of a response to a partially invalid request

HTTP/1.1 400 Bad Request

{
  "0": "ok",
  "1": "ok",
  "2": {
    "name": [
      "У вас уже есть площадка с таким названием"
    ]
  }
}