v2
This is the API you will use to send notifications through PushNotifier.
Authorization is done using Basic Auth. You have to supply your app's package name as the username and
your API token as the password and encode it as base64, like so (shown without base64 encoding):
Authorization: Basic some.app.package:YOURAPITOKENHERE
If you don't have an API token or an app package, yet, visit pushnotifier.de/account/api to get started.
When logging in on behalf of a user, you also have to apply a header X-AppToken
with your issued
app token for the user:
X-AppToken: SOMEAPPTOKENOFAUSERHERE
SSL is enforced. This API cannot be used over HTTP. CORS is supported.
Official SDKs
- PushNotifier for GitHub Actions
- PushNotifier for PHP
- PushNotifier for C++ (by HackHerz)
- PushNotifier for C# (by blackpanther)
- PushNotifier for Python (by Tom Gaimann)
- PushNotifier for node.js (by marco-a)
User
Login
Log in on behalf of a user.
Logging in means to obtain a so-called "App Token" which is used to identify your requests.
Body must be a JSON object in this format:
{ "username": "aUser", "password": "aPassword" }
Requests
{ "username": "aUser", "password": "somePassword" }
Responses
{ "username": "aUser", "avatar": "https://www.gravatar.com/avatar/00000000000000000000000000000000", "app_token": "ZXlKMGVYQWlPaUpLVjFRaUxDSmhiR2NpT2lKSVV6STFOaUo5LmV5SnBZWFFpT2pFMU1EVTROakUwTXpFc0ltcDBhU0k2TnpRNE1EWXNJbWx6Y3lJNklqVkxUV0ZqTG1aeWFYUjZMbUp2ZUNJc0ltNWlaaUk2TVRVeE16WXpOelF6TVN3aVpYaHdJam94TlRFek5qTTNORE15TENKa1lYUWlPbnNpWVhCd1gzUnZhMlZ1SWpvaU0ySTJPR001TldZNE5UTTBNV0pqT1RWaE0yUTBNVEU0TXpNd01UUTFabU5sTXpneE1qUm1ORGhrWm1FeFlqQmhJaXdpY0dGamEyRm5aU0k2SW1OdmJTNW5hV1JwZUM1dFlXZHVkWE1pZlgwLmpXOEVaczh1cHZWLWg2V3lvdkhkQ0dnTU5ndVNHQ0RuZ3ZPX09SdnBmY28", "expires_at": 1513637432 }
When user couldn't be found
When credentials are incorrect
Refresh Token
Refresh your obtained App Token. Same output as /v2/user/login, except for the username.
Refresh a token from API v1
Exchange a token you have obtained from API v1 for a token valid for use with API v2. Same output as /v2/user/refresh.
API v1 appToken
Requests
Devices
Get Devices
Get all devices a user has registered and that are available for sending.
Responses
[ { "id": "ABC", "title": "example@example.org", "model": "E-Mail", "image": "https:\/\/devices.pushnotifier.de\/virtual\/E-Mail.png" }, { "id": "xYz", "title": "iPhone X", "model": "iPhone10,6", "image": "https:\/\/devices.pushnotifier.de\/apple\/iPhoneX.png" } ]
Notifications
Send text
Body must be a JSON object in this format:
{ "devices": […], "content": "Your Text Here" }
devices
has to be an array containing device IDs obtained by /v2/devices.
This endpoint will return a JSON object in this format:
{ "success": [...], "error": [...] }
success
and error
are arrays containing the device IDs that the notification has
been sent or not sent to.
Requests
X-AppToken: ZXlKYQWl…9SY28
{ "devices": ["aXz"], "content": "This is an example!", "silent": false }
Responses
{ "success": ["aXz"], "error": [] }
When the request is malformatted, i.e. missing content
When a device couldn't be found
Send a URL
Body must be a JSON object in this format:
{ "devices": […], "url": "https://example.org" }
devices
has to be an array containing device IDs obtained by /v2/devices.
Same output as /v2/notifications/text
Requests
X-AppToken: ZXlKYQWl…9SY28
{ "devices": ["aXz"], "url": "https://pushnotifier.de", "silent": false }
Responses
{ "success": ["aXz"], "error": [] }
When the request is malformatted, i.e. missing url
When a device couldn't be found
Send a notification
A notification includes some text and a link the user is taking to upon
tapping the notification.
Body must be a JSON object in this format:
{ "devices": […], "content": "Your Text Here", "url": "https://example.org" }
devices
has to be an array containing device IDs obtained by /v2/devices.
Same output as /v2/notifications/text
Requests
X-AppToken: ZXlKYQWl…9SY28
{ "devices": ["aXz"], "content": "This is an example!", "url": "https://pushnotifier.de", "silent": false }
Responses
{ "success": ["aXz"], "error": [] }
When the request is malformatted, i.e. missing content or url
When a device couldn't be found
Send an image
Body must be a JSON object in this format:
{ "devices": […], "content": "base64_encoded_image", "filename": "filename.jpg" }
devices
has to be an array containing device IDs obtained by /v2/devices.content
must be the image in base64, without data-prefix. 5 MB max.
Same output as /v2/notifications/text
Requests
X-AppToken: ZXlKYQWl…9SY28
{ "devices": ["aXz"], "content": "/9j/4AAQSkZJRgABAgAAAQABAAD/7Q…", "filename": "me_at_the_zoo.png", "silent": false }
Responses
{ "success": ["aXz"], "error": [] }
When the request is malformatted, i.e. missing content or filename
When the image is too big (> 5 MB).
When a device couldn't be found