Methods

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

ParameterRequiredTypeDescription
application_keyYesStringApplication public key
sigYesStringRequest signature
session_key/access_tokenNoStringUser session.
Parameter may be obligatory, optional or forbidden depending on the method.
formatNoStringFormat of method response; may be JSON or XML
call_idNoLongRequest order number
__onlineNoBooleanWhether 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), change the value in 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