API documentation for Epic Foundation Inc

/user

User

The properties of a user account can be found at /user:

GET: /user/

Parameter Value
client_id STRING CONDITIONAL The ID of a user. Canonically equivalent to calling /user/. Defaults to the user to whom the Oauth token belongs. The value provided is only taken into account if the Oauth token belongs to a super admin or to a community manager user.

The response is a single user resource:

{ "user": { "firstname": "John", "lastname": "Doe", "email": "john@test.com", "company": "Doe Inc", "language": "English" } }

Example

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

Click on the "Get User" button to get the user details

POST: /user/

Requires scope user-manager or super-admin. All users created via the API have the role user-donor.
Parameter Value
first STRING The first name of the user.
last STRING The last name of the user.
email STRING The email of the user. Must be a valid email format. This is also the internal ID of the client to use when requesting an Oauth2 token.
lang STRING The preferred language of the user. Valid values are en and fr
company STRING The company/organization of the user.

The response is a singleuser resource:

{ "first": "John", "last": "Doe", "email": "john@test.com", "company": "Doe Inc", "lang": "en" }

Example

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

Click on the "Post User" button to create the user profile. It will automatically be granted the scopes user and user-donor


POST: /user/currentEmail

Users of the app can update their profile. Every field must be provided and each value will replace the current one. The current value of the user's email must be provided on the URI. Unless the user has user-admin privileges, that email must match the email associated with the Oauth2 token used.

Requires scope user
Parameter Value
first STRING The first name of the user.
last STRING The last name of the user.
email STRING The email of the user.
company STRING The company/organization of the user.
lang STRING The preferred language of the user. Valid values are en and fr

The response is a singleuser resource:

{ "first": "John", "last": "Doe", "email": "john@test.com", "company": "Doe Inc", "lang": "en" }

Example

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

Click on the "Put User" button to get the user details


User List

The list of users can be found at /user/list:

GET: /user/list

Requires scope user-manager or super-admin
Parameter Value
filter STRING OPTIONAL A fragment of the last name of the user. This fragment will be wildcarded to find any user whose name contains the fragment. Defaults to no filter.
lim INT OPTIONAL The maximum number of users returned. Can be absent or greater than 0. Defaults to unlimited.
offset INT OPTIONAL The rank of the first user returned. Will be ignored if lim is not present. Can be absent or greater than or equal to 0. Defaults to 0. NOTE: If you set an offset greater than the size of your result set, nothing will be returned.

The response is a collection of user resources:

{ "users": [ { "firstname": "John", "lastname": "Doe", "email": "john@test.com", "company": "Doe Inc", "language": "English" }, { "firstname": "Jane", "lastname": "Doe", "email": "jane@test.com", "company": "Doe Inc", "language": "French" } ] }

Example

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

Click on the "Get User List" button to get the user details

User Lang

The preferred language for user can be quickly updated via /user/lang. The user is always the one associated with the current Oauth2 token

POST: /user/lang

Requires scope user
Parameter Value
lang STRING The preferred language of the user. Valid values are en and fr

The successful response is as follows:

{ "status": "success" }

or

{ "error": "update failed" }

Example

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

Click on the "Post User Lang" button to update the user language


User Login Instructions

Download instructions can be requested for a given user. They are sent by email.

POST: /user/login-instructions

Requires scope user-manager
Parameter Value
email STRING The identifier of the user that should receive login instructions. Should be an email.

The successful response is as follows:

{ "status": "success" }

or

{ "error": "Invalid email" }

Example

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

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


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 first 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 first 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 first to have a valid token.

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