curl --request POST \
--url https://{host}/v1/me/test-pushes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/vnd.api+json' \
--data '
{
"data": {
"type": "test-pushes",
"attributes": {
"event": "message"
}
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/vnd.api+json'},
body: JSON.stringify({data: {type: 'test-pushes', attributes: {event: 'message'}}})
};
fetch('https://{host}/v1/me/test-pushes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{host}/v1/me/test-pushes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'type' => 'test-pushes',
'attributes' => [
'event' => 'message'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/vnd.api+json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}import requests
url = "https://{host}/v1/me/test-pushes"
payload = { "data": {
"type": "test-pushes",
"attributes": { "event": "message" }
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/vnd.api+json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"jsonapi": {
"version": "1.0"
},
"meta": {
"event": "message",
"results": [
{
"deviceId": "12",
"platform": "ios",
"transport": "apns",
"apnsEnvironment": "sandbox",
"status": "sent",
"reason": null,
"removed": false
},
{
"deviceId": "15",
"platform": "ios",
"transport": "apns",
"apnsEnvironment": null,
"status": "failed",
"reason": "BadDeviceToken",
"removed": false
}
]
}
}{
"errors": [
{
"status": "404",
"code": "watch_reserved",
"title": "Not Found",
"detail": "<string>",
"meta": {},
"source": {
"pointer": "/data/attributes/reference",
"parameter": "<string>"
}
}
],
"jsonapi": {
"version": "1.0"
}
}Send test notification
Scope: account:write. The Wristler app only. Not in production: there it
answers 404, as if it did not exist — and so does any other environment where test
pushes are switched off.
php artisan push:test for the app’s developer screen. Sends a made-up notification to
the caller’s own devices — never anybody else’s, there is nothing to name them with —
through the same path a real one takes: the preference, the device’s language, the badge,
a bell entry, and the deletion of a registration the platform says is dead.
event is optional, message by default: message, offer_received, offer_accepted,
proposal_received, proposal_expiring, saved_search, price_drop,
favorite_reserved, favorite_sold, payment_instructions, payment_reminder,
payment_failed, payment_received, order_shipped, order_delivered,
order_cancelled, order_expired, on_request_reminder, password_changed,
email_changed, two_factor_changed, sign_in_method_changed, new_sign_in. An
unknown one answers 422 unknown_event with the
list in meta.events. The payload
carries no conversationId or other ids, so a tap lands on the screen for the category.
meta.results has one entry per registered device:
status:sent,failed, orskipped—reasonTurnedOffInPreferenceswhen the event’s category is off for push,NotAttemptedwhen an earlier device’s platform was busy and the send stopped there.reason: what Apple or Google said, as they said it:BadDeviceToken,Unregistered.BadDeviceTokenis most often a token from the other APNs environment.transport:apns,fcm, orlog—logmeans this server has no credentials for that platform and nothing left it, whateverstatussays.apnsEnvironment: the environment the device is known to be in, once one has worked.removed: the platform said the app is gone, so the registration was deleted.
Ten a minute. Past that, 429 too_many_attempts with Retry-After.
curl --request POST \
--url https://{host}/v1/me/test-pushes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/vnd.api+json' \
--data '
{
"data": {
"type": "test-pushes",
"attributes": {
"event": "message"
}
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/vnd.api+json'},
body: JSON.stringify({data: {type: 'test-pushes', attributes: {event: 'message'}}})
};
fetch('https://{host}/v1/me/test-pushes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{host}/v1/me/test-pushes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'type' => 'test-pushes',
'attributes' => [
'event' => 'message'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/vnd.api+json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}import requests
url = "https://{host}/v1/me/test-pushes"
payload = { "data": {
"type": "test-pushes",
"attributes": { "event": "message" }
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/vnd.api+json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"jsonapi": {
"version": "1.0"
},
"meta": {
"event": "message",
"results": [
{
"deviceId": "12",
"platform": "ios",
"transport": "apns",
"apnsEnvironment": "sandbox",
"status": "sent",
"reason": null,
"removed": false
},
{
"deviceId": "15",
"platform": "ios",
"transport": "apns",
"apnsEnvironment": null,
"status": "failed",
"reason": "BadDeviceToken",
"removed": false
}
]
}
}{
"errors": [
{
"status": "404",
"code": "watch_reserved",
"title": "Not Found",
"detail": "<string>",
"meta": {},
"source": {
"pointer": "/data/attributes/reference",
"parameter": "<string>"
}
}
],
"jsonapi": {
"version": "1.0"
}
}