Retrieve Token

Once you have set up a project App, you can then request an access token using your Client ID and Client Secret.

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):

(jsFiddle here)

 var params = {
   grant_type: 'client_credentials',
   client_id: 153,
   client_secret: 'J7SZDPssR885Fo0xczGKqkJfa5XyMK8wxbrOYjio'
 }

  $.ajax({
   url: 'https://five.epicollect.net/api/oauth/token',
   type: 'POST',
   contentType: 'application/vnd.api+json',
   data: JSON.stringify(params),
   success: function(response) {
     console.log(JSON.stringify(response));
   },
   error: function(xhr, status, error) {
     console.log(xhr.responseText);
   }
 });

Please note you cannot access the data using a browser!

HTTP Response

If you run the code above, this is the response you get:

Last updated