REST API v4: GET push notifications
Met deze methode haal je alle verzonden pushnotificaties op die beschikbaar zijn binnen het account.
Om de verzonden pushnotificaties op te halen stuur je een HTTP GET-verzoek naar de volgende URL:
https://api.copernica.com/v4/push/notifications
Teruggegeven velden
Deze methode geeft een collectie van pushnotificaties terug.
| Naam | Beschrijving |
|---|---|
| ID | Unieke identificatie van de pushnotificatie. |
| timestamp | Datum en tijd waarop de pushnotificatie is verzonden. |
| title | Titel van de pushnotificatie. |
| destinations | Aantal ontvangers waarvoor de pushnotificatie is bestemd. |
| channel | Kanaal waarover de pushnotificatie is verzonden, bijvoorbeeld web of mobile. |
| fallback | Eventuele fallback-inhoud die gebruikt wordt wanneer het primaire kanaal niet beschikbaar is. |
| target | Informatie over het doel van de pushnotificatie. |
| target.type | Type doel waarop de pushnotificatie is gericht. |
| target.sources | De onderliggende bronnen waaruit het doel bestaat. |
| target.sources[].id | ID van de bron. |
| target.sources[].type | Type bron, bijvoorbeeld profile, subprofile, view of database. |
JSON voorbeeld
De JSON ziet er bijvoorbeeld als volgt uit:
{
"ID": "1",
"timestamp": "2026-06-04 13:37:04",
"title": "testing push",
"destinations": 0,
"channel": "web",
"fallback": "",
"target": {
"type": "view",
"sources": [
{
"id": "5",
"type": "view"
},
{
"id": "2",
"type": "database"
}
]
}
}
In bovenstaand voorbeeld is de pushnotificatie verzonden naar een view. De view
is onderdeel van database 2 en heeft ID 5.
PHP voorbeeld
Onderstaand script demonstreert hoe je deze API-methode gebruikt.
// vereiste scripts
require_once("CopernicaRestAPI.php");
// verander dit naar je access token
$api = new CopernicaRestAPI("your-access-token", 4);
// voer het verzoek uit
$api->get("push/notifications");
Dit voorbeeld vereist de REST API-klasse.