Add Measurement Unit crm.measure.add

Scope: crm

Who can execute the method: any user

This method adds a new measurement unit.

Method Parameters

Required parameters are marked with *

Name
type

Description

fields*
array

Set of fields — an array of the form array("field"=>"value"[, ...]), containing the values of the measurement unit fields.

To find out the required format of the fields, execute the method crm.measure.fields and check the format of the received values for these fields

Parameter fields

Required parameters are marked with *

Name
type

Description

CODE*
integer

Code

MEASURE_TITLE*
string

Name of the measurement unit

SYMBOL_RUS
string

Symbol

SYMBOL_INTL
string

International symbol

SYMBOL_LETTER_INTL
string

International letter code

IS_DEFAULT
char

Default

Code Examples

How to Use Examples in Documentation

curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"fields":{"CODE":"212","MEASURE_TITLE":"Watt","SYMBOL_RUS":"W","SYMBOL_INTL":"W","SYMBOL_LETTER_INTL":"WTT","IS_DEFAULT":"N"}}' \
        https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.measure.add
        
curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"fields":{"CODE":"212","MEASURE_TITLE":"Watt","SYMBOL_RUS":"W","SYMBOL_INTL":"W","SYMBOL_LETTER_INTL":"WTT","IS_DEFAULT":"N"},"auth":"**put_access_token_here**"}' \
        https://**put_your_bitrix24_address**/rest/crm.measure.add
        
try
        {
        	const response = await $b24.callMethod(
        		'crm.measure.add',
        		{
        			fields: {
        				"CODE": "212",
        				"MEASURE_TITLE": "Watt",
        				"SYMBOL_RUS": "W",
        				"SYMBOL_INTL": "W",
        				"SYMBOL_LETTER_INTL": "WTT",
        				"IS_DEFAULT": "N"
        			}
        		}
        	);
        	
        	const result = response.getData().result;
        	console.info('Created measurement unit with ID ' + result);
        }
        catch(error)
        {
        	console.error('Error:', error);
        }
        
try {
            $response = $b24Service
                ->core
                ->call(
                    'crm.measure.add',
                    [
                        'fields' => [
                            'CODE'              => '212',
                            'MEASURE_TITLE'     => 'Watt',
                            'SYMBOL_RUS'        => 'W',
                            'SYMBOL_INTL'       => 'W',
                            'SYMBOL_LETTER_INTL' => 'WTT',
                            'IS_DEFAULT'        => 'N',
                        ],
                    ]
                );
        
            $result = $response
                ->getResponseData()
                ->getResult();
        
            echo 'Created measurement unit with ID ' . $result;
        
        } catch (Throwable $e) {
            error_log($e->getMessage());
            echo 'Error creating measurement unit: ' . $e->getMessage();
        }
        
BX24.callMethod(
            "crm.measure.add",
            {
                fields: {
                    "CODE": "212",
                    "MEASURE_TITLE": "Watt",
                    "SYMBOL_RUS": "W",
                    "SYMBOL_INTL": "W",
                    "SYMBOL_LETTER_INTL": "WTT",
                    "IS_DEFAULT": "N"
                }
            },
            function(result)
            {
                if(result.error())
                    console.error(result.error());
                else
                    console.info("Created measurement unit with ID " + result.data());
            }
        );
        
require_once('crest.php');
        
        $result = CRest::call(
            'crm.measure.add',
            [
                'fields' =>
                [
                    'CODE' => '212',
                    'MEASURE_TITLE' => 'Watt',
                    'SYMBOL_RUS' => 'W',
                    'SYMBOL_INTL' => 'W',
                    'SYMBOL_LETTER_INTL' => 'WTT',
                    'IS_DEFAULT' => 'N'
                ]
            ]
        );
        
        echo '<PRE>';
        print_r($result);
        echo '</PRE>';
        

Continue Learning