API

 

Запросы к фронтенду / Requests to frontend

Запросы к фронтенду можно передавать любым методом - GET или POST, но формат URI должен строго соответствовать шаблону:
Request to frontend level may be passed in GET or POST form. But URI should be passed exactly in this format:

Request format:

<http|https(if available)>://<domain=core.api.netresult.ru>/<rps=s>/<md5 sign of request>/v<version of api>-sla<sla level>-uid<user id>-sign<service request sign>-req<content of request>

Where

<http|https(if available)>://<domain=core.api.netresult.ru>/<rps=s>/<md5 sign of request>

is a common part for all requests where:

domain			— domain of core API
rps			— route prefix (string). By default = s
md5 sign of request	— checksum for API query string

and where

v<version of api>-sla<sla level 0-9>-uid<user id - integer>-sign<service request sign>-req<content of request - method, data, etc.>

is a service part where:

version of api 		— version of requested API (int)
sla level 		— level of SLA (digit,int) from 0 to 9 or integer for special API versions. By default - digit from 0 to 9.
user id 		— ID of API user. Should be assigned via AUTHENTICATE service.
service request sign	— sign for service request. Calculated from arguments of service part.
content of request	- service name, data, etc.

Example:

http://core.api.netresult.ru/s/6b2a6894a6815db2ca110b67c9d70e87/v2-sla1-uid0-signSOMESIGN-reqTEST=emptyarg

Here "TEST=emptyarg" is a content of request, "TEST" - service name, "=emptyarg" - additional parameters for this service.
Sign for request may be manually calculated by this way:

echo -n 'v1-sla0-uid0-sign0-req0<secret>' | openssl md5 -hex

Примечание: В случае регулярного несовпадения хеша система может заблокировать запросы для определенных адресов.
Note: if sign will be not matched too often then security may block communication for source address.

Сервисы / Services

  • TEST
  • AUTHENTICATE
  • MEGA

Общая схема / General scheme

NETRESUL - CORE - API_general scheme