timeman.networkrange.set
The method sets the office network IP range.
Parameters
Parameter | Example | Required | Description |
---|---|---|---|
RANGES | [{"ip_range":"10.0.0.0-10.255.255.255","name":"Office network 10.x.x.x"}] | Yes | IP range. |
The IP range can contain a range of addresses, for example 10.0.0.0-10.255.255.255 or only one address 10.10.0.1
Call example
JavaScript
BX24.callMethod('timeman.networkrange.set', { ranges: '[{"ip_range":"10.0.0.0-10.255.255.255","name":"Office network 10.x.x.x"},{"ip_range":"172.16.0.0-172.31.255.255","name":"Office network 172.x.x.x"},{"ip_range":"192.168.0.0-192.168.255.255","name":"Office network 192.168.x.x"}]' }, function(result){ if(result.error()) { console.error(result.error().ex); } else { var answer = result.data(); if (answer.result) { console.log('range saved'); } else { console.warn('An error occurred while saving, the following ranges are incorrect', answer.error_ranges); } } });
PHP
$result = restCommand('timeman.networkrange.set', Array( 'RANGES' => Array( Array("ip_range" => "10.0.0.0-10.255.255.255", "name" => "Office network 10.x.x.x"), Array("ip_range" => "172.16.0.0-172.31.255.255", "name" => "Office network 172.x.x.x"), Array("ip_range" => "192.168.0.0-192.168.255.255", "name" => "Office network 192.168.x.x") ) ), $_REQUEST["auth"]);
Response example
On success
{ "result": { result: true } }
When range error occurs
{ "result": { result: false, error_range: [ {ip_range: "a10.0.0.0-10.255.255.255", name: "Office network 10.x.x.x"} ] } }
Keys description
- result - result when saved.
- error_range - array of ranges with errors found:
- ip_range - network IP range.
- name - range name.
Example of response in case of an error
{ "error": "ACCESS_ERROR", "error_description": "You don't have access to user this method" }
- Key error - error code.
- Key error_description - brief error description.
Possible error codes
Code | Description |
---|---|
ACCESS_ERROR | Specified method is available only for administrators. |
INVALID_FORMAT | Incorrect format is passed in the RANGE field. |
© «Bitrix Inc.»,
2001-2021,
«Bitrix Inc.», 2021
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.