API documentation for Epic Foundation Inc

/notification

User Notification Token

One or multiple device-specific notification tokens can be attached to a user profile.

GET: /user/<email>/notification/token

Requires scope user-donor

NOTE: the identifier of the user associated with the token is actually taken from the Oauth2 token unless the user posting the request has the role user-manager. In that case, the user identifier is taken from the URI parameter.

{ "tokens": [ { "token": { "email": "content-manager@epic.foundation", "device_token": "d4_9RguWZNQ:APA91bH677zDilszjdf30-i12-0W-02314-0@0-123495-0-02-Something-rXEtW_wZNXa6K_-V96rEHPEysXSIfL" } } ] }

Example

Make sure your have run the /oauth2/get-token example to have a valid token.

Click on the "Post User Request Instructions" button to update the user language


POST: /user/<email>/notification/token

Requires scope user-donor
Parameter Value
device_token STRING The token to associate to the user profile.

NOTE: the identifier of the user associated with the token is actually taken from the Oauth2 token unless the user posting the request has the role user-manager. In that case, the user identifier is taken from the URI parameter.

{ "token": { "email": "example@epic.foundation", "device_token": "d4_9RguWZNQ:APA91bH677zDilszjdf30-i12-0W-02314-0@0-123495-0-02-Something-rXEtW_wZNXa6K_-V96rEHPEysXSIfL" } }

Example

Make sure your have run the /oauth2/get-token example to have a valid token.

Click on the "Post User Request Instructions" button to update the user language


DELETE: /user/<email>/notification/token/<token>

Requires scope user-donor

NOTE: the identifier of the user associated with the token is actually taken from the Oauth2 token unless the user posting the request has the role user-manager. In that case, the user identifier is taken from the URI parameter.

"success"

Example

Make sure your have run the /oauth2/get-token example to have a valid token.

Click on the "Delete user notification token" button to delete the token


Notification

Notifications can be retrieved at:

GET: /notification

GET: /notification/<notificationId>

Requires scope content-manager
Parameter Value
id STRING OPTIONAL The ID of a specific notification. Can also be presented on the URL as /notification/<notificationId> which takes precedence.
lim INT OPTIONAL The maximum number of notifications returned. Can be absent or greater than 0. Defaults to unlimited.
offset INT OPTIONAL The rank of the notification returned. Will be ignored if lim is not present. Can be absent or greater than or equal to 0. Defaults to 0.
lang STRING OPTIONAL Language filter Should be one of en or fr (case insensitive).
{ "notifications": [ { "notification": { "title": "It's here! Epic's 2018 impact report", "description": "An in-depth look at the impact of Epic organisations", "date": "2019-05-31 21:18:39", "lang": "en", "subtitle": "Discover what your donations have achieved", "visualUrl": "http://lh3.googleusercontent.com/Chv2qHibr0gikLDRQ510JsE-Zvg3Oax8i_dtUQ5rfbp3NRq1rDBBRG8eGlOqdZgc8b7f6C43VEEtyH_YeijlU5dDp48QXs5JTdwvPag", "iconUrl": "https://api.epic.foundation/static/notification_icon.svg", "id": "d879ca2a962c49404727", "actionUrl": "https://news.epic.foundation/library/annual-report-2018-portfolio/", "color": "#FFFFFF" } } ] }

Example

Make sure your have run the /oauth2/get-token example to have a valid token.

Click on the "Get Notifications" button to update the user language


POST: /notification

Requires scope content-manager

Notifications are reviewed periodically to check if any should be issued. When a publication datetime is reached, the list of users who have subscribed to notifications is traversed and for each of them whose preferred language matches the language of the notification resource, a notification is pushed.

Parameter Value
lang STRING REQUIRED Language of the notification. Should be one of en or fr (case insensitive).
title STRING REQUIREDtitle of the notification
subtitle STRING OPTIONALSubtitle of the notification
description STRING OPTIONALDescription of the notification
date STRING OPTIONALUNIX timestamp of the publication datetime. If omitted, no notification will be issued.
resource_id STRING OPTIONAL The Library resource to which the notification relates.
resource_type STRING REQUIRED The type of resources to which the notification relates. Only valid value: Library
{ "notification": { "title": "It's here! Epic's 2018 impact report", "description": "An in-depth look at the impact of Epic organisations", "date": "2019-05-31 21:18:39", "lang": "en", "subtitle": "Discover what your donations have achieved", "visualUrl": "http://lh3.googleusercontent.com/Chv2qHibr0gikLDRQ510JsE-Zvg3Oax8i_dtUQ5rfbp3NRq1rDBBRG8eGlOqdZgc8b7f6C43VEEtyH_YeijlU5dDp48QXs5JTdwvPag", "iconUrl": "https://api.epic.foundation/static/notification_icon.svg", "id": "d879ca2a962c49404727", "actionUrl": "https://news.epic.foundation/library/annual-report-2018-portfolio/", "color": "#FFFFFF" } }

Example

Make sure your have run the /oauth2/get-token example to have a valid token.

Click on the "Post Notification" button to update the user language


DELETE: /notification/<notificationId>

Requires scope content-manager
"success"

Example

Make sure your have run the /oauth2/get-token example to have a valid token.

Click on the "Delete User Request Instructions" button to update the user language