Поиск по сайту

API
Главная / API - User authorization

User authorization

Обновлено 10.07.2020
102 кб

General information

This service allows performing the following actions:

  • authorizing user (to get session ID);
  • closing the current session;
  • getting data on the current session.

User authorization 

Method request

Request example

Method address: https://api.dellin.ru/v3/auth/login.json

{
   "appkey": "00000000-0000-0000-0000-000000000000",
   "login": "info@info.ru",
   "password": "Password1"
}

Method address: https://api.dellin.ru/v3/auth/login.xml 

<request>
   <appkey>00000000-0000-0000-0000-000000000000</appkey>
   <login>info@info.ru</login>
   <password>Password1</password>
</request>

Description of parameters

Request
Request
ParameterRequiredTypeDescription
appkeyYesstring

Application key. To get the key, register

loginYesstring

Personal account login.

Either email or phone number can be used as login.

Phone number format: "+7XXXXXXXXXX" (12 characters starting with "+7")

passwordYesstringPersonal account password

Method response

Response example

{ 
   "metadata":{
      "status":200,
      "generated_at":"2015-06-18 12:37:28"
   },
   "data":{
      "sessionID":"00000000-0000-0000-0000-000000000000"
   }
}
<response>
   <metadata>
      <status>200</status>
      <generated_at>2015-06-18 12:37:28</generated_at>
   </metadata>
   <data>
      <sessionID>00000000-0000-0000-0000-000000000000</sessionID>
   </data>
</response>

Description of parameters

Response
Response
ParameterTypeDescription
metadataobjectSystem information
metadata.statusintegerEmulated status http-code. If successful, code 200 is returned
metadata.generated_atstring

Server response date and time.

Format: YYYY-MM-DD HH:MM:SS

dataobjectSession data
data.sessionIDstringSession ID for getting access to Personal account data

Error handling

The common API errors are used with the method, for errors format description and errors list see Errors of API methods.

Closing the current session

Method request

Request example

Method address: https://api.dellin.ru/v3/auth/logout.json 

{
   "appkey":"00000000-0000-0000-0000-000000000000",
   "sessionID":"00000000-0000-0000-0000-000000000000"
}

Method address: https://api.dellin.ru/v3/auth/logout.xml 

<request>
   <appkey>00000000-0000-0000-0000-000000000000</appkey>
   <sessionid>00000000-0000-0000-0000-000000000000</sessionid>
</request>

Description of parameters

Request
Request
ParameterRequiredTypeDescription
appkeyYesstring

Application key. To get the key, register

sessionIDYesstringSession ID for getting access to Personal account data

Method response

Response example

{
   "metadata":{
      "status":200,
      "generated_at":"2015-06-18 12:37:28"
   },
   "data":{
      "state":"success"
   }
}
<response>
   <metadata>
      <status>200</status>
      <generated_at>2015-06-18 12:37:28</generated_at>
   </metadata>
   <data>
      <state>success</state>
   </data>
</response>

Description of parameters

Response
Response
ParameterTypeDescription
metadataobjectSystem information
metadata.statusintegerEmulated status http-code. If successful, code 200 is returned
metadata.generated_atstring

Server response date and time.

Format: YYYY-MM-DD HH:MM:SS

dataobjectSuccess confirmation
data.statestring

Request status. Possible value - "success"

Error handling

The common API errors are used with the method, for errors format description and errors list see Errors of API methods.

Data on the current session

Information about the status of the current session may be useв for session resumption before sending a request to API of the personal account.

Method request

Request example

Method address: https://api.dellin.ru/v3/auth/session_info.json 

{
   "appkey":"00000000-0000-0000-0000-000000000000",
   "sessionID":"00000000-0000-0000-0000-000000000000"
}

Method address: https://api.dellin.ru/v3/auth/session_info.xml  

<request>
   <appkey>00000000-0000-0000-0000-000000000000</appkey>
   <sessionid>00000000-0000-0000-0000-000000000000</sessionid>
</request>

Description of parameters

Success confirmation
Request
ParameterRequiredTypeDescription
appkeyYesstring

Application key. To get the key, register

sessionIDYesstring

Session ID for getting access to Personal account data

Method response

Response example for active session

{
   "metadata":{
      "status":200,
      "generated_at":"2015-06-18 12:37:28"
   },
   "data":{
      "session":{
         "expireTime":"2014-04-12 18:01",
         "expired":false
      }
   }
}
<response>
   <metadata>
      <status>200</status>
      <generated_at>2015-06-18 12:37:28</generated_at>
   </metadata>
   <data>
      <session>
         <expireTime>2014-04-12 18:01</expireTime>
         <expired>false</expired>
      </session>
   </data>
</response>

Description of parameters

Response
Response
ParameterTypeDescription
metadataobjectSystem information
metadata.statusintegerEmulated status http-code. If successful, code 200 is returned
metadata.generated_atstring

Server response date and time.

Format: YYYY-MM-DD HH:MM:SS

dataDataSession info
Data
Data
ParameterTypeDescription
sessionobjectCurrent session info
session.expireTimestring

Expiration date and time of the current session. If session is expired then the parameter value is "null".

Format: YYYY-MM-DD HH:MM

session.expiredboolean

Session status.

Possible values:

  • "false" - session is not expired;
  • "true" - session is expired

Error handling

The common API errors are used with the method, for errors format description and errors list see Errors of API methods.