REST API v4: GET subprofile push notifications
Met deze methode haal je alle pushnotificaties op die zijn verzonden naar een specifiek subprofiel.
Een pushnotificatie kan via verschillende kanalen zijn verzonden, zoals browser pushnotificaties of mobiele pushnotificaties.
Om de pushnotificaties van een subprofiel op te halen stuur je een HTTP GET-verzoek naar de volgende URL:
https://api.copernica.com/v4/subprofile/$id/push/notifications
Hierbij moet $id worden vervangen door het ID van het subprofiel.
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, database, view, collection of miniview. |
JSON voorbeeld
De JSON ziet er bijvoorbeeld als volgt uit:
{
"ID": "1",
"timestamp": "2025-02-04 13:37:04",
"title": "testing push",
"destinations": 0,
"channel": "web",
"fallback": "",
"target": {
"type": "subprofile",
"sources": [
{
"id": "5678",
"type": "subprofile"
}
]
}
}
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);
// vervang {$id} door het ID van het subprofiel
$api->get("subprofile/{$id}/push/notifications");
Dit voorbeeld vereist de REST API-klasse.