API methods

campaign_update

POST /

Updates (creates, if don’t exist) campaign data, including banners.

Note

The params attribute contains a list of adpay.iface.proto.CampaignObject.

Example request:

POST / HTTP/1.1
Host: example.com

{
 "jsonrpc": "2.0",
 "method": "campaign_update",
 "id": 2,
 "params": [
      {
          "time_start": 1543326642,
          "campaign_id": "BXfmBKBdsQdDOdNbCtxd",
          "time_end": 1643326642,
          "advertiser_id": "QdDOdNbCtxdAXfmBKBds",
          "max_cpc": 0.01,
          "filters": {
                      "require": {
                                  "age": ["18--30"],
                                  "interest": ["cars"],
                                  "movies": ["action", "horror", "thriller"]
                                  },
                      "exclude": {"country": ["DE"]}
                      },
          "budget": 0.75,
          "keywords": "{JSONObject object}",
          "banners": [
                  {
                      "keywords": {"movies": "horror"},
                      "banner_id": "ZBOGqlCqaqjDICNWHRnT",
                      "banner_size": "100x400"
                  },
                  {
                      "keywords": {"movies": "action"},
                      "banner_id": "FcNMkMibdAZMSdqugKvb",
                      "banner_size": "100x400"
                  }
          ],
          "max_cpm": 0.005
      }
      ]
  }
  ]
 }

Example success response:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "jsonrpc": "2.0",
    "result": "True",
    "id": 2
}
Response Headers:
 
Status Codes:

campaign_delete

POST /

Removes campaign data (including banners) from AdSelect database.

Example request:

POST / HTTP/1.1
Host: example.com

{
 "jsonrpc": "2.0",
 "method": "campaign_delete",
 "id": 2,
 "params": [
            "432gfdxhs",
            "3wr42trse",
            "fsdsafsw4"
           ]
 }

Example success response:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "jsonrpc": "2.0",
    "result": "True",
    "id": 2
}
Response Headers:
 
Status Codes:

add_events

POST /

Add information about impressions to AdSelect.

Example request:

POST / HTTP/1.1
Host: example.com

{
 "jsonrpc": "2.0",
 "method": "add_events",
 "id": 2,
 "params": [
            {
          "banner_id": "gPSlyhJAJwYnNmOLEWyl",
          "event_type": "nORtFGEyjnEwznpmAUZL",
          "event_id": "LWRNjngSddILRIhVTjAg",
          "timestamp": 1543326642,
          "their_keywords": "{JSONObject object}",
          "our_keywords": "{JSONObject object}",
          "human_score": 1.0,
          "publisher_id": "cyXugkOnQvZlTzrOMVgb",
          "event_value": 0.5,
          "user_id": "eOOor4RuwcFdGXG2"
      }
          ]
 }

Example success response:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "jsonrpc": "2.0",
    "result": "True",
    "id": 2
}
Response Headers:
 
Status Codes:

get_payments

POST /

Request payments.

Example request:

POST / HTTP/1.1
Host: example.com

{
 "jsonrpc": "2.0",
 "method": "get_payments",
 "id": 2,
 "params": [{"timestamp": 1643326642}]
}

Example success response:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "jsonrpc": "2.0",
    "result": [
                {
                "event_id": "EMtkCfWfcaVwmreyLSyL",
                "amount": 0.965
                },
                {
                "event_id": "caVwmreyLdasSyL",
                "amount": 0.165
                }
               ],
    "id": 2
}

Example not calculated yet response:

HTTP/1.1 200 OK
Content-Type: application/json

{
 "jsonrpc": "2.0",
 "id": 2,
  "error": {
            "message": "Payments not calculated yet.",
            "code": -32603
            }
}
Response Headers:
 
Status Codes: