List of REST methods
All API methods are available with GET and POST requests.
Every method is available on 2 URLs:
{api_server}fb.do?method=[method_name] - e.g., https://api.ok.ru/fb.do?method=friends.get
{api_server}api/[method_group]/[method_name] - e.g., https://api.ok.ru/api/friends/get
A corresponding GET parameter should be used as {api_server}. If it is missing, https://api.ok.ru/ is used.
General request parameters
Parameter | Required | Type | Description |
---|---|---|---|
application_key | Yes | String | Application public key |
sig | Yes | String | Request signature |
session_key/access_token | No | String | User session. Parameter may be obligatory, optional or forbidden depending on the method |
format | No | String | Format of method response; may be JSON only |
call_id | No | Long | Request order number |
__online | No | Boolean | Whether to mark a user as online (effective for messengers). True by default |
Calculating request signature
- when the session_secret_key value is absent:
- to call without session – session_secret_key = application_secret_key;
- to call in session – session_secret_key = MD5(access_token + application_secret_key), convert the value to the lower case;
- take session_key/access_token away from the list of parameters, if applicable;
- parameters are sorted lexicographically by keys;
- parameters are joined in the format key=value;
- sig = MD5(parameters_value + session_secret_key);
- the sig value is changed to the lower case.
Application paramters
User session data
|
Method
List of paramters
Используем для подписи secret_key = session_secret_key
Используем для подписи secret_key = application_secret_key
Используем для подписи secret_key = MD5(access_token + application_secret_key)
secret_key =
Сортируем и склеиваем параметры запроса и secret_key
Рассчитываем MD5 от полученной строки и получаем параметр sig