Update Product Section crm.productsection.update

Scope: crm

Who can execute the method: any user

The method crm.productsection.update updates an existing product section.

Method Parameters

Required parameters are marked with *

Name
type

Description

id*
integer

Identifier of the product section

fields
array

Set of fields — an array in the form array("field_to_update"=>"value"[, ...]), where "field_to_update" can take values from the returned method crm.productsection.fields.

Note

To find out the required format of the fields, execute the method crm.productsection.fields and check the format of the returned values for those fields.

Code Examples

How to Use Examples in Documentation

id=$(prompt "Enter ID")
        sectionName=$(prompt "Enter section name")
        
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{
            "id": '"$id"',
            "fields": {
                "NAME": "'"$sectionName"'"
            }
        }' \
        https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.productsection.update
        
id=$(prompt "Enter ID")
        sectionName=$(prompt "Enter section name")
        
        curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{
            "id": '"$id"',
            "fields": {
                "NAME": "'"$sectionName"'"
            },
            "auth": "**put_access_token_here**"
        }' \
        https://**put_your_bitrix24_address**/rest/crm.productsection.update
        
try
        {
        	const id = prompt("Enter ID");
        	const sectionName = prompt("Enter section name");
        
        	const response = await $b24.callMethod(
        		"crm.productsection.update",
        		{
        			id: id,
        			fields:
        			{
        				"NAME": sectionName
        			}
        		}
        	);
        
        	const result = response.getData().result;
        	if(result.error())
        	{
        		console.error(result.error());
        	}
        	else
        	{
        		console.info(result);
        	}
        }
        catch(error)
        {
        	console.error('Error:', error);
        }
        
$id = readline("Enter ID: ");
        $sectionName = readline("Enter section name: ");
        
        try {
            $response = $b24Service
                ->core
                ->call(
                    'crm.productsection.update',
                    [
                        'id' => $id,
                        'fields' => [
                            'NAME' => $sectionName
                        ]
                    ]
                );
        
            $result = $response
                ->getResponseData()
                ->getResult();
        
            if ($result->error()) {
                error_log($result->error());
            } else {
                echo 'Success: ' . print_r($result->data(), true);
            }
        
        } catch (Throwable $e) {
            error_log($e->getMessage());
            echo 'Error updating product section: ' . $e->getMessage();
        }
        
var id = prompt("Enter ID");
        var sectionName = prompt("Enter section name");
        BX24.callMethod(
            "crm.productsection.update",
            {
                id: id,
                fields:
                {
                    "NAME": sectionName
                }
            },
            function(result)
            {
                if(result.error())
                    console.error(result.error());
                else
                {
                    console.info(result.data());
                }
            }
        );
        
require_once('crest.php');
        
        $id = readline("Enter ID: ");
        $sectionName = readline("Enter section name: ");
        
        $result = CRest::call(
            'crm.productsection.update',
            [
                'id' => $id,
                'fields' => [
                    'NAME' => $sectionName
                ]
            ]
        );
        
        if (isset($result['error'])) {
            echo "Error: " . $result['error_description'] . "\n";
        } else {
            echo "Updated section with ID " . $id . "\n";
            echo '<PRE>';
            print_r($result['result']);
            echo '</PRE>';
        }