Add Measurement Unit crm.measure.add

Choose a tool for developing with an AI agent:

  • use Alaio Vibecode to build an app for Bitrix24 from a task description without knowing any programming language. The agent writes the code and deploys the app to a server, with no manual hosting setup
  • use the MCP server to develop a REST API integration in your own project. The agent refers to the official REST documentation

Scope: crm

Who can execute the method: any user

DEPRECATED

The development of this method has been halted. Please use catalog.measure.add.

This method adds a new measurement unit.

Method Parameters

Required parameters are marked with *

Name
type

Description

fields*
array

A set of fields — an array in 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 incoming 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('Measurement unit created 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 'Measurement unit created 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("Measurement unit created 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>';
        
// client and ctx are already created — see the Go SDK section
        res, err := client.Core().Call(ctx, "crm.measure.add", b24.Params{
        	"fields": b24.Params{
        		"CODE":               "212",
        		"MEASURE_TITLE":      "Watt",
        		"SYMBOL_RUS":         "W",
        		"SYMBOL_INTL":        "W",
        		"SYMBOL_LETTER_INTL": "WTT",
        		"IS_DEFAULT":         "N",
        	},
        })
        if err != nil {
        	return fmt.Errorf("crm.measure.add: %w", err)
        }
        
        // The response arrives as json.RawMessage — unmarshal it
        // into a struct matching the response shape shown below on this page.
        fmt.Printf("%s\n", res.Result)
        

Continue Learning