Skip to content

Latest commit

 

History

History
322 lines (260 loc) · 9.41 KB

File metadata and controls

322 lines (260 loc) · 9.41 KB

Get Additional Fields of the Page landing.landing.getadditionalfields

{% note tip "" %}

If you are developing integrations for Bitrix24 using AI tools (Codex, Claude Code, Cursor), connect to the MCP server so that the assistant can utilize the official REST documentation.

{% endnote %}

Scope: landing

Who can execute the method: a user with "view" access permission for the site

The method landing.landing.getadditionalfields retrieves additional fields of the page.

Method Parameters

{% include Note on required parameters %}

#| || Name type | Description || || scope string | Internal scope of the landing. It is not related to the REST scope landing in the method name.

The value of scope must correspond to the type of site (detailed description) || || lid* integer | Identifier of the page.

The page identifier can be obtained using the landing.landing.getList method, as well as from the results of the landing.landing.add, landing.landing.addByTemplate, and landing.landing.copy methods || |#

Code Examples

{% include Note on Examples %}

{% list tabs %}

  • cURL (Webhook)

    curl -X POST \
      -H "Content-Type: application/json" \
      -d '{
        "lid": 349
      }' \
      "https://**put.your-domain-here**/rest/**user_id**/**webhook_code**/landing.landing.getadditionalfields.json"
  • cURL (OAuth)

    curl -X POST \
      -H "Content-Type: application/json" \
      -d '{
        "lid": 349,
        "auth": "**put_access_token_here**"
      }' \
      "https://**put.your-domain-here**/rest/landing.landing.getadditionalfields.json"
  • JS (TS)

    // This snippet is an ES module: top-level await requires type="module" or a bundler.
    // $b24 is an already-initialized SDK instance (see the SDK "Get started" guide).
    import { Text } from '@bitrix24/b24jssdk'
    import type { B24Frame } from '@bitrix24/b24jssdk'
    
    declare const $b24: B24Frame
    
    // Shape of the payload returned in result (match the "response handling" section of the page)
    type AdditionalFieldsResult = Record<string, string | number | boolean | string[]>
    
    try {
      const response = await $b24.actions.v2.call.make<AdditionalFieldsResult>({
        method: 'landing.landing.getadditionalfields',
        params: {
          lid: 349,
        },
        requestId: Text.getUuidRfc4122()
      })
    
      // The payload is available only on a successful response
      if (!response.isSuccess) {
        console.error(response.getErrorMessages().join('; '))
      } else {
        const result = response.getData()!.result
        console.info('Additional fields:', Object.keys(result).length, result)
      }
    } catch (error) {
      // Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
      console.error(error)
    }
  • JS (UMD)

    <!-- Load the SDK (UMD build); it is exposed as the global B24Js -->
    <script src="https://unpkg.com/@bitrix24/b24jssdk@1/dist/umd/index.min.js"></script>
    <script>
      async function getAdditionalFields() {
        try {
          // Initialize the SDK inside a Bitrix24 frame
          const $b24 = await B24Js.initializeB24Frame()
    
          const response = await $b24.actions.v2.call.make({
            method: 'landing.landing.getadditionalfields',
            params: {
              lid: 349,
            },
            requestId: B24Js.Text.getUuidRfc4122()
          })
    
          // The payload is available only on a successful response
          if (!response.isSuccess) {
            console.error(response.getErrorMessages().join('; '))
            return
          }
    
          const result = response.getData().result
          console.info('Additional fields:', Object.keys(result).length, result)
        } catch (error) {
          // Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
          console.error(error)
        }
      }
    
      document.addEventListener('DOMContentLoaded', getAdditionalFields)
    </script>
  • PHP

    try {
        $response = $b24Service
            ->core
            ->call(
                'landing.landing.getadditionalfields',
                [
                    'lid' => 349,
                ]
            );
    
        $result = $response
            ->getResponseData()
            ->getResult();
    
        echo 'Success: ' . print_r($result, true);
    } catch (Throwable $e) {
        error_log($e->getMessage());
        echo 'Error getting additional fields: ' . $e->getMessage();
    }
  • BX24.js

    BX24.callMethod(
        'landing.landing.getadditionalfields',
        {
            lid: 349
        },
        function(result)
        {
            if (result.error())
            {
                console.error(result.error());
            }
            else
            {
                console.info(result.data());
            }
        }
    );
  • PHP CRest

    require_once('crest.php');
    
    $result = CRest::call(
        'landing.landing.getadditionalfields',
        [
            'lid' => 349,
        ]
    );
    
    if (isset($result['error']))
    {
        echo 'Error: ' . $result['error_description'];
    }
    else
    {
        echo '<pre>';
        print_r($result['result']);
        echo '</pre>';
    }
  • Go

    // client and ctx are already created — see the Go SDK section
    res, err := client.Core().Call(ctx, "landing.landing.getadditionalfields", b24.Params{
    	"lid": 349,
    })
    if err != nil {
    	return fmt.Errorf("landing.landing.getadditionalfields: %w", err)
    }
    
    var item struct {
    	FontsCode     string `json:"FONTS_CODE"`
    	GacounterUse  string `json:"GACOUNTER_USE"`
    	MetamainUse   string `json:"METAMAIN_USE"`
    	MetamainTitle string `json:"METAMAIN_TITLE"`
    	MetaogTitle   string `json:"METAOG_TITLE"`
    	MetaogImage   string `json:"METAOG_IMAGE"`
    }
    if err := json.Unmarshal(res.Result, &item); err != nil {
    	return fmt.Errorf("parse response: %w", err)
    }
    fmt.Println(item.FontsCode, item.GacounterUse)

{% endlist %}

Response Handling

HTTP Status: 200

Below is a shortened example of a response. The actual set of fields depends on the page settings and the additional fields connected to it.

{
    "result": {
        "FONTS_CODE": "<noscript><link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/...\" data-font=\"g-font-russo-one\"></noscript>",
        "GACOUNTER_USE": "N",
        "METAMAIN_USE": "Y",
        "METAMAIN_TITLE": "Festival in New York. April 20-26, 2022. Buy tickets online",
        "METAOG_TITLE": "Festival in New York. April 20-26, 2022. Buy tickets online",
        "METAOG_IMAGE": "https://cdn.com/.../cover_1x.webp",
        "SETTINGS_PRICE_CODE": [
            "BASE"
        ],
        "SETTINGS_SHOW_PRICE_COUNT": 1,
        "THEMEFONTS_LINE_HEIGHT": "1.6",
        "VIEW_TYPE": "no",
        "YACOUNTER_USE": "N"
    },
    "time": {
        "start": 1773722096,
        "finish": 1773722096.682451,
        "duration": 0.6824510097503662,
        "processing": 0,
        "date_start": "2026-03-17T12:34:56+01:00",
        "date_finish": "2026-03-17T12:34:56+01:00",
        "operating_reset_at": 1773722696,
        "operating": 0.11843705177307129
    }
}

Returned Data

#| || Name type | Description || || result object | array | A set of additional fields of the page in the format {"<FIELD_CODE>": "<VALUE>"}.

If the page has no available non-empty additional fields, the method returns an empty array [] (detailed description) || || time time | Information about the execution time of the request || |#

Object result {#result}

#| || Name type | Description || || <FIELD_CODE> string | integer | boolean | array | object | Pair "field code → field value". The method returns only fields with non-empty values.

Available field codes are listed in the section Additional Fields of the Page || |#

Error Handling

HTTP Status: 400

{
    "error": "LANDING_NOT_EXIST",
    "error_description": "Landing not found"
}

{% include notitle error handling %}

Possible Error Codes

#| || Code | Description || || MISSING_PARAMS | Required parameter lid is missing || || LANDING_NOT_EXIST | Page not found: the lid parameter contains the identifier of a non-existent or inaccessible page || || ACCESS_DENIED | Insufficient rights to call the method || |#

{% include system errors %}

Continue Learning