跳到主要内容

Примеры запросов для отправки универсальных push-уведомлений

Пример успешного запроса

POST https: //vkpns-universal.rustore.ru/v1/send HTTP/2
Content-Type: application/json
{
"providers":{
"rustore": {
"auth_token": "AAAbbbCC123" ,
"project_id": "aabbcc"
},
"fcm": {
"auth_token": "321CCbbAAA" ,
"project_id": "ccbbaa"
}
},
"tokens": {
"rustore":["bk3RNwTe3H"],
"fcm":["CI2k_HHwgIpoDKC"]
},
"message":{
"notification":{
"body": "This is a notification message!" ,
"title": "Message"
}
}
}
HTTP/2 200
Content-Type: application/json
{
"Status": "OK"
}

Пример невалидного провайдера

POST https: //vkpns-universal.rustore.ru/v1/send HTTP/2
Content-Type: application/json
{
"providers":{
"rustore": {
"auth_token": "AAAbbbCC123" ,
"project_id": "aabbcc"
},
"fcm": {
}
},
"tokens": {
"rustore":["bk3RNwTe3H"],
"fcm":["CI2k_HHwgIpoDKC"]
},
"message":{
"notification":{
"body": "This is a notification message!" ,
"title": "Message"
}
}
}
HTTP/2 400
Content-Type: application/json
{
"status": "VALIDATION_ERROR" ,
"code": 400,
"errors": [
"providers.fcm: project_id is a required field" ,
"providers.fcm: auth_token is a required field"
]
}

Пример невалидного сообщения

POST https: //vkpns-universal.rustore.ru/v1/send HTTP/2
Content-Type: application/json
{
"providers":{
"rustore": {
"auth_token": "AAAbbbCC123" ,
"project_id": "aabbcc"
},
"fcm": {
"auth_token": "321CCbbAAA" ,
"project_id": "ccbbaa"
}
},
"tokens": {
"rustore":["bk3RNwTe3H"],
"fcm":["CI2k_HHwgIpoDKC"]
},
"message":{
"notification":{
}
}
}
HTTP/2 400
Content-Type: application/json
{
"status": "VALIDATION_ERROR" ,
"code": 400,
"errors": [
"message.notification: title is a required field" ,
"message.notification: body is a required field"
]
}

Пример ошибки провайдера

POST https: //vkpns-universal.rustore.ru/v1/send HTTP/2
Content-Type: application/json
{
"providers":{
"rustore": {
"auth_token": "AAAbbbCC123" ,
"project_id": "aabbcc"
},
"fcm": {
"auth_token": "321CCbbAAA" ,
"project_id": "ccbbaa"
}
},
"tokens": {
"rustore":["bk3RNwTe3H"],
"fcm":["CI2k_HHwgIpoDKC"]
},
"message":{
"data":{ "test": "test" }
}
}
}
HTTP/2 400
Content-Type: application/json
{
"status": "PROVIDER_ERROR" ,
"code": 400,
"errors": [
"fcm: invalid auth token"
]
}