Notifications

Notifications within autoZnetwork for the currently authenticated user by application.

List Notifications

GET Request: https://api.autoznetwork.com/v1/applications/{APPLICATION_SLUG}/notifications

CURL
AUTOZNETWORK_TOKEN="your API token"
AUTOZNETWORK_ORG_ID="your organization id"
AUTOZNETWORK_APPLICATION_ID="your application id"

curl https://api.autoznetwork.com/v1/applications/$AUTOZNETWORK_APPLICATION_ID/notifications \
  -H "Authorization: Bearer $AUTOZNETWORK_TOKEN" \
  -H "X-AutozNetwork-Organization-Id: $AUTOZNETWORK_ORG_ID" \
  -H 'Accept: application/json'
PHP
<?php 
$apiToken = 'ABCD12345 ...';
$organizationId = '1234';
$applicationSlug = 'your application slug';

$autoZnetwork = new AutozNetwork($apiToken);

$notifications = $autoznetwork
                  ->withOrganization($organizationId)
                  ->applications($applicationSlug)
                  ->notifications()
                  ->get();

print($notifications)

Create a Notification

POST Request: https://api.autoznetwork.com/v1/applications/{APPLICATION_SLUG}/notifications

CURL
AUTOZNETWORK_TOKEN="your API token"
AUTOZNETWORK_ORG_ID="your organization id"
AUTOZNETWORK_APPLICATION_ID="your application id"

curl -X POST https://api.autoznetwork.com/v1/applications/$AUTOZNETWORK_APPLICATION_ID/notifications \
  -H "Authorization: Bearer $AUTOZNETWORK_TOKEN" \
  -H "X-AutozNetwork-Organization-Id: $AUTOZNETWORK_ORG_ID" \
  -H 'Accept: application/json'
PHP
<?php 
$apiToken = 'ABCD12345 ...';
$organizationId = '1234';
$applicationSlug = 'your application slug';

$autoZnetwork = new AutozNetwork($apiToken);

$notification = $autoznetwork
                  ->withOrganization($organizationId)
                  ->applications($applicationSlug)
                  ->notifications()
                  ->create([
                    'body' => 'your notification',
                    'url' => 'https://yourapplication.com'
                  ]);

print($notification)

Mark a Notification as Read

POST Request: https://api.autoznetwork.com/v1/applications/{APPLICATION_SLUG}/notifications/{NOTIFICATION_ID}/read

CURL
AUTOZNETWORK_TOKEN="your API token"
AUTOZNETWORK_ORG_ID="your organization id"
AUTOZNETWORK_APPLICATION_ID="your application id"
AUTOZNETWORK_NOTIFICATION_ID="your notification id"

curl -X POST https://api.autoznetwork.com/v1/applications/$AUTOZNETWORK_APPLICATION_ID/notifications/$AUTOZNETWORK_NOTIFICATION_ID/read \
  -H "Authorization: Bearer $AUTOZNETWORK_TOKEN" \
  -H "X-AutozNetwork-Organization-Id: $AUTOZNETWORK_ORG_ID" \
  -H 'Accept: application/json'
PHP
<?php 
$apiToken = 'ABCD12345 ...';
$organizationId = '1234';
$applicationSlug = 'your application slug';
$notificationId = 'your notification id';

$autoZnetwork = new AutozNetwork($apiToken);

$notification = $autoznetwork
                  ->withOrganization($organizationId)
                  ->applications($applicationSlug)
                  ->notifications($notificationId)
                  ->markAsRead();

print($notification)