In order to get access to the API an application token (appToken) is required. This will be provided by the EPS Foundation. The appToken is used to obtain a deviceToken which will be used for all further communication with the platform.

appToken

The appToken is unique for each participating app and is required for the retrieval of a deviceToken.

Example: eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJBUEkgRGV2IFN3YWdnZXIiLCJpc3MiOiJtc21wIiwidHlwZSI6ImFwcFRva2VuIiwiZXhwIjoxNTE4MjA3MTcyLCJpYXQiOjE0ODY2NzExNzJ9.Q7TKFGcJ5uS6HMifPgccCLf-TeCqVprKE61hluSW7nQ

deviceToken Swagger

Each instance of an 'MSMP enabled' app needs a deviceToken to be abled to communicatie with the API. The lifetime of a deviceToken is limited, so the app must be able to retrieve a new deviceToken when there is no valid deviceToken available.

to request a deviceToken execute this HTTP POST :

/v2/devices

The header must contain the appToken:

'appToken'    : 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJBUEkgRGV2IFN3YWdnZXIiLCJpc3MiOiJtc21wIiwidHlwZSI6ImFwcFRva2VuIiwiZXhwIjoxNTE4MjA3MTcyLCJpYXQiOjE0ODY2NzExNzJ9.Q7TKFGcJ5uS6HMifPgccCLf-TeCqVprKE61hluSW7nQ',
'Accept'      : 'application/json',
'Content-Type': 'application/json'

When the appToken is valid the platform will provide a deviceToken in the response token field:

{
    "token":"eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJuYW1lLTIwMTctMDYtMjdUMTU6MzY6MjEsMTc2NDE3OTU4KzAyOjAwIiwiaXNzIjoibXNtcCIsInR5cGUiOiJkZXZpY2VUb2tlbiIsImV4cCI6MTUzMDEwNjU4MSwiaWF0IjoxNDk4NTcwNTgxLCJzZXEiOjI1OH0.O6zMiIKTD9432TUwFgviXtEkS12es646d3E5dkcy0z0",
    "uuid":"e6c65f1c-6890-4f63-8111-7b66ec445a45"
}

Example code for javascript:

var _msmpRequest = function () {
    // Construct the http config object
    var config = {};
    config.headers = {
        'appToken': 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJBUEkgRGV2IFN3YWdnZXIiLCJpc3MiOiJtc21wIiwidHlwZSI6ImFwcFRva2VuIiwiZXhwIjoxNTE4MjA3MTcyLCJpYXQiOjE0ODY2NzExNzJ9.Q7TKFGcJ5uS6HMifPgccCLf-TeCqVprKE61hluSW7nQ',
        'Accept': 'application/json',
        'Content-Type': 'application/json'
    };
    config.method = 'POST';
    config.url = 'apitest.msmplatform.nl/v2/devices';
    config.data = {};

    // Send the request angular
    return $http(config).then(function(response){
        return response;
    });
    // Send the request ajax
    return $.ajax(_constructUrl(target), config)
                .done(/*function for done*/)
                .fail(/*function for fail*/)
                .always(/*function for always*/);
});