Documentation

Calling Methods with Confirmation

Some methods to be called require confirmation of an account administrator. When an app calls such method, an account administrator receives notification with the option to permit or deny the call, and the app will receive an error.

Attention! The permission or denial are given to specific authorization token, with which the method call is performed. That is, the permission is valid until the token is valid - when a next token is received, a new permission is required.

GET https://portal.bitrix24.com/rest/voximplant.user.get?auth=fkp963yuv1ggkfbs5z3f5hy8lilm0iw6&USER_ID=1
HTTP/1.1 401 Unauthorized

{
    "error": "METHOD_CONFIRM_WAITING", 
    "error_description": "Waiting for confirmation"
}

If the method is called prior the confirmation or a response, it will return the same response, but without the request for repeated confirmation.

When receiving the permission or denial by the administrator, the event OnAppMethodConfirm handler will be called. It receives the confirmation result as well as a token, via which this permission was issued:

array (
  'event' => 'ONAPPMETHODCONFIRM',
  'data' => 
  array (
    'TOKEN' => 'fkp963yuv1ggkfbs5z3f5hy8lilm0iw6',
    'METHOD' => 'voximplant.user.get',
    'CONFIRMED' => '1',
    'LANGUAGE_ID' => 'en',
  ),
  'ts' => '1478790852',
  'auth' => 
  array (
    'domain' => 'account.bitrix24.com',
    'client_endpoint' => 'https://account.bitrix24.com/rest/',
    'server_andpoint' => 'https://oauth.bitrix.info/rest/',
    'member_id' => '74ef8a46a75104de55d5d4a61b98ab6d',
    'application_token' => 'c289487163b58658eae5e8b42eaf11b8',
  ),

If the administrator has permitted the action, application can use the same authorization token for the work with the requested method:

GET https://portal.bitrix24.com/rest/voximplant.user.get?auth=fkp963yuv1ggkfbs5z3f5hy8lilm0iw6&USER_ID=1
HTTP/1.1 200 OK

{
    "result": [
        {
            "DEFAULT_LINE": null, 
            "ID": "1", 
            "INNER_NUMBER": null, 
            "PHONE_ENABLED": "Y", 
            "SIP_LOGIN": "****", 
            "SIP_PASSWORD": "*****", 
            "SIP_SERVER": "*****"
        }
    ]
}

In case of a denial, the following error will return:

GET https://portal.bitrix24.com/rest/voximplant.user.get?auth=fkp963yuv1ggkfbs5z3f5hy8lilm0iw6&USER_ID=1
HTTP/1.1 403 Forbidden

{
    "error": "METHOD_CONFIRM_DENIED", 
    "error_description": "Method call denied"
}

List of methods, requiring confirmation can be found here:



© «Bitrix24», 2001-2024