(en) This method registers a user's device on the server when a user launches an application at the first time. After the registration the server sends:
- unique identificator QUELLE-DUID in the UUID format
- JWT token generated on the base of QUELLE-DUID
(ru) Метод для регистрации устройства пользователя на сервере при запуске первом запуске приложения. При регистрации на серверной стороне выдаются:
- уникальный идентификатор QUELLE-DUID в формате UUID
- JWT токен, который сгенерирован на основе этого QUELLE-DUID
На JWT есть стандарт https://tools.ietf.org/html/rfc7519 По-человечески написано тут https://auth0.com/docs/jwt
REQUSET:
TYPE:
POST
PATH:
api.quelle.ru/v1/usr/device
Content-Type:
application-json
BODY:
{
"deviceInfo": {
"adid": "ffsdfsf43534534rrrrtret", -- (opt) advertising id (IDFA на iOS, GAID на Android)
"platform": "ios", -- (req) platform, valid values: "android", "ios"
"token": "ffsdfsf43534534rrrrtret", -- (opt) push-token for sending push-notificatons
"uuid": "ffsdfsf43534534rrrrtret", -- (req) installation unique id (IFV for iOS, UUID for Android generating by device)
"timezone": "10800", -- (req) user’s timezone in seconds (to send push-notifications)
"device": "iPhone7s", -- (req) device
"os_version": "10.2", -- (req) version OS
"app_version": "1.2.1", -- (req) version APP
"locale": "ru" -- (req) language locale (we are going use it for texts in push notifications)
},
"location": -- ( opt) coordinates
{
"lat": 37.4501173, -- (req) lat
"lon": 55.5450368 -- (req) lon
}
}
Comments:
- req - parameter is required
- opt - parameter is optional
- adid - can contains zero’s for example "00000-000000-0000000-000000", if If the user has disabled advertising ad tracking
- token - can be empty if user hasn’t given permission to send him push-notifications
- location - can be empty if user hasn’t given permission to get his location
RESPONSE:
HTTP STATUS CODE 201 -- the code 201 returns in case of successful device registration
HEADERS:
Authorization -- token is setted here and must be used in all API parts
Example:
Authorization: sdfsdfdf9824986245945dfsfsdfdsf.dsfsdfsdfsdf
QUELLE-DUID: -- device uuid, it will be sent in mobile analytics services
Example:
QUELLE-DUID: 48358437568-345345-345-345fgfdg-435-dfg
BODY:
none
(en) ADID (IDFA / GAID) and push-token can change during application life time, that’s why we need to update them on the server-side. The request is calles at each application start and sends all updated device IDs. As a result of the request, Authorization token can be updated. As with the POST request, the request is considered successful if the second hundred codes (2xx) are returned.
(ru) Так как ADID (IDFA / GAID) и пуш-токен могут меняться во время жизни приложения нужно уметь обновлять их на сервере. Запрос выполняется на каждом старте приложения и присылает все обновлённые идентификаторы устройства. В результате запроса может быть обновлён Authorization токен. Как и в случае с POST-запросом, запрос считается успешно выполненым, если возвращается коды второй сотни(2xx).
REQUSET:
TYPE:
PATCH
PATH:
api.quelle.ru/v1/usr/device
Content-Type:
application-json
Headers
Authorization: <token> jwt token
BODY:
{
"deviceInfo": {
"adid": "ffsdfsf43534534rrrrtret",
"token" "ffsdfsf43534534rrrrtret",
"timezone": "10800",
"os_version": "10.2",
"app_version": "1.2.1",
"locale": "ru"
},
"location": {
"lat": 37.4501173,
"lon": 55.5450368
}
}
RESPONSE:
HTTP STATUS CODE 204 -- the code 204 returns in case of successful id updates
HEADERS:
Authorization
Example:
Authorization: sdfsdfdf9824986245945dfsfsdfdsf.dsfsdfsdfsdf
QUELLE-DUID:
Example:
QUELLE-DUID: 48358437568-345345-345-345fgfdg-435-dfg
BODY:
none