Sélectionner une page

Before you start :

This is the technical documentation for the asynchronous and server-side reward of the users of an app’.

Environments :

You need to have an active partner environment (partnerId and PartnerSecret), and an dedicated backend app created on the app’s miles backoffice. In this backoffice, you need to create your generosity actions (for instance birthdayReward)

2 environments are supported : Sandbox (https://api-sandbox.appsmiles.eu/2.0/) and Production (https://api.appsmiles.eu/2.0/)

Authentication :

Credentials consist of :

  • APMPartnerID : given by your app’s miles contact
  • partnerSecret : given by your app’s miles contact
  • appId : recorded in the backoffice (such as com.mycompany.myapp)

Request token :

Those credentials must be sent in POST method to the endpoint /buffer/token

And you’ll get a response like this one :

{
 "access_token": "7c14533f495f3d67c72f939f51360b8c09177844f",
 "token_type": "bearer",
 "expires_in": 3600
}

In case of error, you get a response like this :

{
 "errorCode": 1,
 "errorMsg": "aucun partenaire ne correspond à ces éléments"
}

Token need to be included in all request made to the API using the AUTHORIZATION header :

AUTHORIZATION : Bearer TOKEN

 

Reward a user :

To reward a user, you need to use the endpoint /buffer/store and sent in POST method these parameters :

  • appId : recorded in the backoffice (ex: as com.mycompany.myapp)
  • partnerClientId : the user’s GUID in your company (string)
  • tagId : the tag code of the generosity action (as in the backoffice)
  • lang : iso code (ex: fr)
  • date : date of the reward (optional, ex: 15/04/2016)
  • param1 : (optional parameter) if set, will be used to check unicity of the triplet « partnerClientId / tagId / param1 »

If everythig is alright, you’ll get the response :

{
 "errorCode": 0,
 "errorMsg": "ok"
}

If an error occurs, you receive the message :

{
 "errorCode": 2,
 "errorMsg": "invalid token"
}

or

{
 "errorCode": 3,
 "errorMsg": "All parameters are required"
}

 

Conclusion :

The user balance will be credited a few minute after the server-side reward storage

version 1.1