Documentation
Search…
BackEnd
Our BackEnd API is documented using Postman
. You will find in the link below the technical details for each endpoints.
But before heading to that documentation, read
📖
below a summary of how our API works, and what each endpoint does.

Introduction

There are two sections in this collection:
    Front-end endpoints (if you want to reproduce the mobile/web SDK's behaviour without going through it)
    Back-end endpoints (server to server)

Front-end endpoints workflow

Only two endpoints work without a userToken: partner/getprog and user/clientcheckcredentials. In order to call any of the other front-end endpoints, you will need to retrieve the userToken sent in user/clientcheckcredentials (data.user.userToken) which connects the user. See the JWT token section to understand where to place the userToken in your requests.
path
description
partner/getprog
Get all the information about the app's miles program for a non-connected user
partner/initialcheckstore
Same than getprog + information specific to that user
user/clientcheckcredentials
Connects/creates the user (creates them if they don't exist)
user/historyburns
List of all the gifts they bought
user/historyearns
List of all the actions they completed
user/logout
Disconnects the user (on all devices)
user/delete
Deletes the user and all of their history from app's miles' server
generosity/store
Equivalent to the SDK's triggerAction, validates(+stores) an action
gift/list
List of available gifts for the user
gift/checkavailability
Buys a gift if user has enough points
ad/bonus
List of bonus ads
ad/specials
List of special ads
ad/news
List of news ads

Back-end endpoints workflow

You must first get a token via auth/token before calling the other endpoints. See the JWT token section to understand where to place the token in your requests.
path
description
auth/token
Returns the token needed for the other endpoints
buffer/store
Back-end equivalent to generosity/store, validates(+stores) an action
generosity/multistore
Validates(+stores) an action for multiple users
user/incrementalinfos
List of users with their info, completed actions and purchased gifts
user/infos
List of users with their info
user/info
Returns a single user's information
user/ranking
List of n users below and above the given user
user/multidelete
Deletes one or multiple users

Creating a JWT token

1
$timestamp = time();
2
$partnerID = {{to_fill}};
3
$partnerSecret = {{to_fill}};
4
$token = {{to_fill}}; // userToken (frontend) or token (backend), empty for auth/token
5
$requestHeaders = {{to_fill}};
6
$requestBody = {{to_fill}};
7
8
$header = [
9
“alg” =>HS256,
10
“typ” =>JWT
11
];
12
13
$payload = [
14
“iss” => $partnerID, // The "iss" (issuer) claim identifies the principal that issued the JWT.
15
“sub” => $token, // The "sub" (subject) claim identifies the principal that is the subject of the JWT
16
“iat” => $timestamp, // The "iat" (issued at) claim identifies the time at which the JWT was issued. UTC.
17
“data_header” => json_encode($requestHeaders),
18
“data_body” => json_encode($requestBody)
19
];
20
21
$signature = HMACSHA256(
22
base64UrlEncode($header) . "." .
23
base64UrlEncode($payload),
24
$partnerSecret
25
);
26
27
$jwtToken = base64UrlEncode($header) . "." . base64UrlEncode($payload) . "." . $signature;
Copied!
Last modified 6mo ago