跳到主要内容

Примеры API для отправки уведомлений по топикам

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

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