Skip to content

Latest commit

 

History

History
465 lines (380 loc) · 12.6 KB

File metadata and controls

465 lines (380 loc) · 12.6 KB

Get Task Field tasks.task.field.get

{% note tip "" %}

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

{% endnote %}

Scope: tasks

Who can execute the method: any user

{% note info "" %}

This method belongs to REST 3.0. The call specifics and response format of the new API version are described in the REST 3.0 overview.

{% endnote %}

The method tasks.task.field.get returns the description of a task field by name.

Method Parameters

{% include Note on required parameters %}

#| || Name type | Description || || name* string | The name of the field whose description is to be retrieved || || select array | A list of description fields to return in the response.

Available fields:

  • name — field name
  • type — data type
  • title — title
  • description — description
  • validationRules — validation rules
  • requiredGroups — required groups
  • filterable — filter availability indicator
  • sortable — sort availability indicator
  • editable — editability indicator
  • multiple — multiple value indicator
  • elementType — element type for composite fields || |#

Code Examples

{% include Example Notes %}

{% note info "" %}

The new API call differs by adding the /api/ segment to the request URL:

https://{installation_address}/rest/api/{user_id}/{webhook_token}/tasks.task.field.get

{% endnote %}

{% list tabs %}

  • cURL (Webhook)

    curl -X POST \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -d '{"name":"id","select":["name","type","title","description","filterable","sortable","multiple"]}' \
    https://**put_your_bitrix24_address**/rest/api/**put_your_user_id_here**/**put_your_webhook_here**/tasks.task.field.get
  • cURL (OAuth)

    curl -X POST \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -d '{"name":"id","select":["name","type","title","description","filterable","sortable","multiple"],"auth":"**put_access_token_here**"}' \
    https://**put_your_bitrix24_address**/rest/api/tasks.task.field.get
  • 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 TaskFieldGetResult = {
      item: {
        name: string
        type: string
        title: string
        description: string
        validationRules: unknown[]
        requiredGroups: string[] | null
        filterable: boolean
        sortable: boolean
        editable: boolean
        multiple: boolean
        elementType: string | null
      }
    }
    
    try {
      const response = await $b24.actions.v3.call.make<TaskFieldGetResult>({
        method: 'tasks.task.field.get',
        params: {
          name: 'id',
          select: [
            'name',
            'type',
            'title',
            'description',
            'filterable',
            'sortable',
            'multiple',
          ],
        },
        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('Field item:', result.item)
      }
    } 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 getTaskField() {
        try {
          // Initialize the SDK inside a Bitrix24 frame
          const $b24 = await B24Js.initializeB24Frame()
    
          const response = await $b24.actions.v3.call.make({
            method: 'tasks.task.field.get',
            params: {
              name: 'id',
              select: [
                'name',
                'type',
                'title',
                'description',
                'filterable',
                'sortable',
                'multiple',
              ],
            },
            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('Field item:', result.item)
        } catch (error) {
          // Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
          console.error(error)
        }
      }
    
      document.addEventListener('DOMContentLoaded', getTaskField)
    </script>
  • Python

    from b24pysdk.errors import BitrixAPIError, BitrixSDKException
    
    select = [
        "name",
        "type",
        "title",
        "description",
        "filterable",
        "sortable",
        "multiple",
    ]
    
    try:
        bitrix_response = client.tasks.task.field.get(
            name='id',
            select=select,
        ).response
        result = bitrix_response.result
        print(result)
    except BitrixAPIError as error:
        print(
            "Bitrix API error",
            f"error: {error.error}",
            f"error_description: {error.error_description}",
            sep="\n",
        )
    except BitrixSDKException as error:
        print(f"Bitrix SDK error: {error.message}")
    except Exception as error:
        print(f"Unexpected error: {error}")
  • PHP

    SDKs do not yet support the /rest/api/ address in calls. Use direct HTTP requests, for example, via curl or fetch.

    try {
        $response = $b24Service
            ->core
            ->call(
                'tasks.task.field.get',
                [
                    'name' => 'id',
                    'select' => [
                        'name',
                        'type',
                        'title',
                        'description',
                        'filterable',
                        'sortable',
                        'multiple'
                    ]
                ]
            );
    
        $result = $response
            ->getResponseData()
            ->getResult();
    
        echo 'Success: ' . print_r($result, true);
    
    } catch (Throwable $e) {
        error_log($e->getMessage());
        echo 'Error: ' . $e->getMessage();
    }
  • BX24.js

    SDKs do not yet support the /rest/api/ address in calls. Use direct HTTP requests, for example, via curl or fetch.

    BX24.callMethod(
        'tasks.task.field.get',
        {
            name: 'id',
            select: [
                'name',
                'type',
                'title',
                'description',
                'filterable',
                'sortable',
                'multiple'
            ]
        },
        function(result){
            console.info(result.data());
            console.log(result);
        }
    );
  • PHP CRest

    SDKs do not yet support the /rest/api/ address in calls. Use direct HTTP requests, for example, via curl or fetch.

    require_once('crest.php');
    
    $result = CRest::call(
        'tasks.task.field.get',
        [
            'name' => 'id',
            'select' => [
                'name',
                'type',
                'title',
                'description',
                'filterable',
                'sortable',
                'multiple'
            ]
        ]
    );
    
    echo '<PRE>';
    print_r($result);
    echo '</PRE>';
  • Go

    // client and ctx are already created — see the Go SDK section
    res, err := client.Core().Call(ctx, "tasks.task.field.get", b24.Params{
    	"name":   "id",
    	"select": []string{"name", "type", "title", "description", "filterable", "sortable", "multiple"},
    }, b24.WithIdempotent())
    if err != nil {
    	return fmt.Errorf("tasks.task.field.get: %w", err)
    }
    
    // The method wraps the response in an object with the "item" key.
    raw, ok := b24.Unwrap(res.Result, "item")
    if !ok {
    	return fmt.Errorf("no item key in the response")
    }
    
    var item struct {
    	Name        string `json:"name"`
    	Type        string `json:"type"`
    	Title       string `json:"title"`
    	Description string `json:"description"`
    	Filterable  bool   `json:"filterable"`
    	Sortable    bool   `json:"sortable"`
    }
    if err := json.Unmarshal(raw, &item); err != nil {
    	return fmt.Errorf("parse response: %w", err)
    }
    fmt.Println(item.Name, item.Type)

{% endlist %}

Response Handling

HTTP Status: 200

{
    "result": {
        "item": {
            "name": "id",
            "type": "int",
            "title": "ID",
            "description": "Identifier",
            "validationRules": [],
            "requiredGroups": null,
            "filterable": true,
            "sortable": true,
            "editable": false,
            "multiple": false,
            "elementType": null
        }
    },
    "time": {
        "start": 1773649754,
        "finish": 1773649754.213566,
        "duration": 0.21356606483459473,
        "processing": 0,
        "date_start": "2026-03-16T11:29:14+01:00",
        "date_finish": "2026-03-16T11:29:14+01:00",
        "operating_reset_at": 1773650354,
        "operating": 0
    }
}

Returned Data

#| || Name type | Description || || result object | Object containing the response data || || item object | Object with field description. The response structure depends on select || || time time | Information about the request execution time || |#

Error Handling

HTTP Status: 400

{
    "error": {
        "code": "BITRIX_REST_V3_EXCEPTION_VALIDATION_REQUESTVALIDATIONEXCEPTION",
        "message": "Error during request object validation",
        "validation": [
            {
                "field": "name",
                "message": "Required field `name` is missing"
            }
        ]
    }
}

{% include notitle error handling %}

Possible Error Codes

Access Errors

Error Code: BITRIX_REST_V3_EXCEPTION_ACCESSDENIEDEXCEPTION

#| || Field | Error Description | How to Fix || || - | Access denied | Check user permissions and the task scope || |#

Data Not Found Errors

Error Code: BITRIX_REST_V3_REALISATION_EXCEPTION_FIELDNOTFOUNDEXCEPTION

#| || Field | Error Description | How to Fix || || name | Field #FIELD# not found | Provide an existing field name || |#

Request Validation Errors

Error Code: BITRIX_REST_V3_EXCEPTION_VALIDATION_REQUESTVALIDATIONEXCEPTION

#| || Field | Error Description | How to Fix || || name | Required field name is missing | Pass the name parameter with an existing field name || |#

Errors in the select Parameter

Error Code: BITRIX_REST_V3_EXCEPTION_UNKNOWNDTOPROPERTYEXCEPTION

#| || Field | Error Description | How to Fix || || select | Unknown field #FIELD# for entity DtoFieldDto | Pass only fields from the list: name, type, title, description, validationRules, requiredGroups, filterable, sortable, editable, multiple, elementType || |#

Error Code: BITRIX_REST_V3_EXCEPTION_INVALIDSELECTEXCEPTION

#| || Field | Error Description | How to Fix || || select | Unable to recognize select expression #SELECT# | Pass select as an array of strings, e.g., ["name","type"] || |#

{% include system errors %}

Continue Learning