login
To get a token, use the forms mentioned in login.
To work under the token, token/login is used. The method signature is as follows:
svc=token/login¶ms={"token":<text>,
"operateAs":<text>,
"fl":<uint>
}
Parameters
The request can contain the following parameters. The required parameters are marked with an asterisk (*).
Name | Description |
---|---|
token* | Unique token name. Consists of 72 symbols. |
operateAs | Subuser name for login. The parameter is optional. |
fl* | Response flags (see below). |
Response flags
Flag in HEX | Flag in DEC | Description |
---|---|---|
0x1 | 1 | Basic information. |
0x2 | 2 | User information. |
0x4 | 4 | Token information. |
0x8 | 8 | Information about items. |
0x10 | 16 | Information about billing services. |
0x20 | 32 | Custom properties of the user. |
How to get a token name
- Create a new token (token/update method, callmode:create);
- If tokens are already created, execute the token/list method.
You can’t log in using a non-activated token (at parameter in token parameters).
Response
If the request is completed successfully, a new token parameter is added to all token parameters as a value. The response of the following format is returned:
{
"eid": <text>, /* Session ID. */
"gis_sid": <text>, /* Session ID for GIS services. */
"host": <text>, /* Host. */
"hw_gw_ip": <text>, /* Hardware gateway IP. */
"au": <text>, /* Username. */
"pi": <int>, /* Ping interval. */
"tm": <uint>, /* Current time (UTC). */
"wsdk_version": <text>, /* SDK version */
"user": { /* User on whose behalf you want to perform login. */
"nm": <text>, /* Name. */
"cls": <uint>, /* ID of superclass "user". */
"id": <long>, /* ID */
"prp": { /* Custom properties, for example: */
"dst": <text>, /* Daylight saving time */
"language": <text>, /* Language (two-letter code) */
"msakey": <text>, /* Access key to the mobile site */
"pcal": <text>, /* Iranian calendar */
"tz": <text>, /* Time zone */
"us_units": <text>, /* US metrics (miles and gallons) */
...
},
"crt": <uint>, /* Creator ID. */
"bact": <uint>, /* Account ID. */
"fl": <uint>, /* User flags. */
"hm": <text>, /* Host mask. */
"uacl": <uint>, /* User access to their account. */
"mu": <uint>, /* Measurement system. */
"ct": <uint>, /* User creation date. */
"ftp": { <text> }, /* FTP settings */
"ld": <uint>, /* Last login date. */
"pfl": <uint>, /* Creator flag */
"ap": { /* Two-factor authentication settings */
"type": <uint>, /* Authentication type (0 - none, 1 - email, 2 - SMS). */
"phone": <text> /* Phone number. */
},
"mapps": { <text> }, /* Mobile apps list. */
"mappsmax": <int> /* Restrictions on mobile applications specified in the billing plan. */
},
"classes": { /* Superclasses available to the current user (key - superclass name, value - superclass ID): */
"avl_hw": <uint>, /* Hardware type */
"avl_resource": <uint>, /* Resource */
"avl_retranslator": <uint>, /* Retranslator */
"avl_unit": <uint>, /* Unit */
"avl_unit_group": <uint>, /* Unit group */
"user": <uint>, /* User */
"avl_route": <uint> /* Route */
},
"features": {
"unlim": <bool>, /* Billing plan type: 0 - regular, 1 - special (for development/testing). */
"svcs": { /* Hash collection of allowed services. If the service is not mentioned here, it is forbidden. */
"<service_name>": <bool>, /* Key - service name, value: 0 - the service is available, but the limit is reached; 1 - the service is available and can be used */
...
}
},
..., /* Core/login response. */
"token": "{\"app\":\"<text>\",\"ct\":<uint>,\"at\":<uint>,\"dur\":<uint>,\"fl\":<uint>,\"p\":\"<text>\",\"items\":[<long>]}",
/* All token settings as escaped JSON. */
... /* Core/login response */
}
If the request fails, an error code is returned.
Error codes
Error code | Description |
---|---|
6 | Unknown error. |
4 | Wrong token length. |
1003 | Limit of requests. |
7 | User disabled, token activation time not reached, no access to service. |
8 | The specified subuser is not found or you have no access rights to this user. |