Targeting registration
Targeting Registration API is divided into API for registering targeting information and API for registering targeting data. When the API for registering targeting information requests basic data, the returned targeting ID and targeting description request to save upon running the API for registering targeting data. The targeting ID and its description are synced with the registration API for targeting information.
Prerequisites¶
To sync with the API for registering targeting information, make sure to issue an authorization token (API KEY). If you already have the key, request the additional permissions. Refer to Hive Server API > Notification > Push v4 > Authentication to check how to request and issue the authorization token.
API for registering targeting information¶
Basic data and request variables¶
Method | POST | ||||
URL | /push/targets | ||||
Division | Field Name | Description | Type | Required | |
Header | Content-Type | application/json;charset=utf-8 | |||
Authorization | bearer {{API KEY}} | ||||
Body | company | Company name (e.g., gamevil, com2us, gcp) | String | O | |
companyIndex | Company code (the company number registered on AppCenter) | Integer | O | ||
registrant | id | The ID of registration requester | String | O | |
name | The name of registration requester | String | X | ||
description | Targeting title or description | String | O | ||
game | gameindex | Game index | Integer | O |
Output result¶
Division | Field Name | Description | Type | Required | |
Header | Content-Type | application/json;charset=utf-8 | |||
UUID | {{UUID}} | ||||
Body | id | Targetting ID | Long | O | |
company | The same with Request data | String | O | ||
companyIndex | Integer | O | |||
registrant | id | String | O | ||
name | String | X | |||
description | String | O | |||
game | gameindex | Integer | O | ||
available | Availability | Boolean | O |
Response state code¶
Key | Value | Description |
---|---|---|
200 | Success | (Body is empty) |
400 | Bad Request | POST data is omitted JSON format error Required element is omitted or invalid Available to check additionally with reason message in Body |
401 | Unauthorized | Authorization header in request message is omitted or invalid Authorization token (API KEY) is not registered No access permission to the relevant API |
403 | Forbidden | Authorization scheme of Authorization header is not "Bearer" (Supported Bearer only) |
404 | Not Found | Request URL is wrong |
500 | Internal Server Error | Internal error on server |
502 | Bad Gateway | Push gateway server is overloaded Network connects in a wrong way |
503 | Service Unavailable | API server or authorization server is frozen |
Sample code¶
- Call
curl -L
-d '{"companyIndex": 3, "company" : "gcp", "registrant":{"id":"pushmanager", "name":"push administrator"}, "description":"push targeting test", "game":{"gameindex":592}}'
-H "Content-Type: application/json"
-H "Authorization: Bearer {API KEY}"
https://sandbox-notification.qpyou.cn/push/targets
- Request
> POST /push/targets HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: sandbox-notification.qpyou.cn
> Accept: */*
> Content-Type: application/json
> Authorization: Bearer {API KEY}
> Content-Length: 143
- Response
< HTTP/1.1 200 OK
< Content-Length: 180
< Content-Type: application/json
< UUID: 6f75eab9-9e66-40da-a375-a5209cea6a9c
<
* Connection #0 to host sandbox-notification.qpyou.cn left intact
* Closing connection #0
{"id":11,"companyIndex": 3, "company" : "gcp", "game":{"gameindex":592},"description":"Tergeting test","registrant":{"name":"identifier_name","id":"identifier_id"},"available":false,"locked":false}
API for registering targeting data¶
Basic data and request variables¶
Method | POST | ||||
URL | /push/targets/{{targeting ID}}/direct/new | ||||
Division | Field Name | Description | Type | Required | |
Header | Content-Type | application/json;charset=utf-8 | |||
Authorization | bearer {{API KEY}} | ||||
Body | - | The list of targeting data Check the targeting structure and example below. | Target[] | O |
Targeting structure¶
Division | Field Name | Description | Type | Required | |
Target | Identifier | playerId | Make sure to input one of four identifiers. | Long | O |
vid | Long | ||||
uid | Long | ||||
did | Long | ||||
app | appid | String | O |
Targeting example¶
[
{
"identifier": {
"playerId": 1,
"did": 1000
},
"app": {
"appid": "com.gcp.stepbystep.ios.apple.global.ent"
}
}
]
Output result¶
Header | Content-Type | application/json;charset=utf-8 | ||
UUID | {{UUID}} | |||
SUCCESS: HTTP Status Code == 200 |
Error¶
Division | Field Name | Description | Type | Required | |
FAILURE: HTTP Status Code !== 200 | |||||
Body | error | reason | The reason of error occurrence | String | X |
Sample code¶
- Call
curl -L
-H "Content-Type: application/json"
-H "Authorization: Bearer {API KEY}"
-d '[ { "identifier": { "playerId": 1, "did": 1000 }, "app": { "appid": "com.gcp.stepbystep.ios.apple.global.ent" } }, { "identifier": { "playerId": 2, "did": 2000 }, "app": { "appid": "com.gcp.stepbystep.android.google.global.normal" } } ]'
https://sandbox-notification.qpyou.cn/push/targets/11/direct/new
- Request
> POST /push/targets/11/direct/new HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: sandbox-notification.qpyou.cn
> Accept: */*
> Content-Type: application/json
> Authorization: Bearer {API KEY}
> Content-Length: 236
- Response