Retrieve Token
Once you have set up a project App, you can then request an access token using your Client ID and Client Secret.
PLEASE NOTE: access tokens are valid for 2 hours after they are issued.

HTTP REQUEST

We assume the base domain is five.epicollect.net
POST /api/oauth/token
therefore https://five.epicollect.net/api/oauth/token

POST Parameters

Parameter
Required
Description
grant_type
yes
Must have value 'client_credentials'.
client_id
yes
The Client ID of your project App.
client_secret
yes
The Client Secret of your project App.
Here is an example based on our EC5 API Private project, using jQuery (more on jQuery Ajax requests):
1
var params = {
2
grant_type: 'client_credentials',
3
client_id: 153,
4
client_secret: 'J7SZDPssR885Fo0xczGKqkJfa5XyMK8wxbrOYjio'
5
}
6
7
$.ajax({
8
url: 'https://five.epicollect.net/api/oauth/token',
9
type: 'POST',
10
contentType: 'application/vnd.api+json',
11
data: JSON.stringify(params),
12
success: function(response) {
13
console.log(JSON.stringify(response));
14
},
15
error: function(xhr, status, error) {
16
console.log(xhr.responseText);
17
}
18
});
Copied!
Please note you cannot access the data using a browser!

HTTP Response

If you run the code above, this is the response you get:
1
{
2
"token_type": "Bearer",
3
"expires_in": 7200,
4
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6Ijk5OTE4YWZmMDczYjY2MjJlNWQyODVjMzJjZTM0Y2M1MTA1MDQxY2ZjOTc2MDY5ZDE4NWU5ZDQ3ZDI0MTJkYzQ4NWM0NTI2NmQyNDdhNTYzIn0.eyJhdWQiOiIyIiwianRpIjoiOTk5MThhZmYwNzNiNjYyMmU1ZDI4NWMzMmNlMzRjYzUxMDUwNDFjZmM5NzYwNjlkMTg1ZTlkNDdkMjQxMmRjNDg1YzQ1MjY2ZDI0N2E1NjMiLCJpYXQiOjE0OTQ0MjU3MzMsIm5iZiI6MTQ5NDQyNTczMywiZXhwIjoxNDk0NDMyOTMzLCJzdWIiOiIiLCJzY29wZXMiOltdfQ.S-Lsn8uP_GlUyz5fa-QUICpkyXUvFf4L4StUYYGoJCIPdqMtS7OZqbg1oJgNvCtBnqVO4LTv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