Documentation

Using REST Methods

Before an application can use REST API's, it has to be registered in marketplace. Once registered, the application possess all data required to obtain an OAuth 2.0 key.

A common REST API call has the following format:

https://intranet_domain.bitrix24.{ru|en|de}/rest/method_name.transport?method_parameters&auth=auth_key

Here "transport" is an optional parameters that can be json or xml. The default value is json.

REST API supports both GET and POST requests.

Examples

This call obtains a list of available methods in XML format:

https://my.bitrix24.com/rest/methods.xml?auth=d161f25928c3184678924ec127edd29a

The following request returns a list of all items of the menu entity as JSON.

https://my.bitrix24.com/rest/entity.item.get.json?ENTITY=menu&auth=d161f25928c3184678924ec127edd29a

There are methods that can accept files as the parameter values. In this case, send an array whose first item is the file name, and the second item is the file itself, base64 encoded. Rather than an array, you can send just a string representing the file contents in base64 encoding, in which case the file name will be auto generated.

On return, the system response has the following format. All the fields are optional except for result or error:

{
	"result":the method execution result,
	"error":the method execution error,
	"total":the number of records in response (for methods that return data in chunks or pages),
	"next":a number that needs to be sent to get the next page of data
}

For the methods that return data in chunks, each chunk contains 50 items by default (the chunk size can be changed). To get the next chunk of data, add the start parameter to the request with the value specified by the next response field.

However, the batch method that executes multiple requests in series returns a different response structure:

{
	"result":array of request results,
        "result_error":array of request errors,
        "result_total":array each of whose items contains the number of 
                   records in responses for methods returning 
                   multiple data chunks (see above),
        "result_next":array of 'next' values (see above).
}



User Comments

User comments are not part of official documentation. Use information provided by other users in the comments at your own risk.

The User Comments section is not to be used as a feature discussion board. Only registered users can post comments. Your comment will be visible once it has been approved by the moderator.
© «Bitrix Inc.», 2001-2017, «Bitrix Inc.», 2017