Creating attributes

Creates attributes of customers and orders When creating custom attributes, don't use the IDs of system attributes. To get the list of IDs of system attributes, use the method GET /cdp/api/v1/counter/{counterId}/schema/attributes.

  1. Request syntax
  2. In the request body
  3. Response format

Request syntax

counterId: Tag ID.

https://api-metrika.yandex.net/cdp/api/v1/counter/{counterId}/schema/attributes
 ? entity_type=<system_entity_namespace>
entity_type *Attribute ownership.

Acceptable values:

  • CONTACT: Attributes belong to contacts.
  • COMPANY: Attributes belong to companies.
  • ORDER: Attributes belong to orders.
  • SIMPLE_ORDER: Attributes belong to simple orders.
entity_type *Attribute ownership.

Acceptable values:

  • CONTACT: Attributes belong to contacts.
  • COMPANY: Attributes belong to companies.
  • ORDER: Attributes belong to orders.
  • SIMPLE_ORDER: Attributes belong to simple orders.

* Required

In the request body


--data '{
        "attributes": [
            {
                "name": "dates_of_meetings",
                "type_name": "date",
                "multivalued": true,
                "humanized": "Dates of contacts with the shop"
            },
            {
                "name": "age",
                "type_name": "numeric",
                "multivalued": false,
                "humanized": "Age"
            },
            {
                "name": "first_seen",
                "type_name": "date",
                "multivalued": false,
                "humanized": "First order"
            }
        ]
    }'

Parameters Description
attributes List of attributes.
attributes
name Attribute ID.
type_name Attribute type ID.
type_group Group of this attribute type. Can be calculated automatically based on the type_name field value. Case insensitive.

Possible values:

  • PREDEFINED: Scalar attribute type. Examples of type_name values: numeric, date, datetime, email, and text.
  • CUSTOM_LIST: Arbitrary attribute type.
  • SYSTEM_LIST: Product list, type_name: product.
multivalued Determines whether the attribute can have multiple values.
humanized Attribute name.
Parameters Description
attributes List of attributes.
attributes
name Attribute ID.
type_name Attribute type ID.
type_group Group of this attribute type. Can be calculated automatically based on the type_name field value. Case insensitive.

Possible values:

  • PREDEFINED: Scalar attribute type. Examples of type_name values: numeric, date, datetime, email, and text.
  • CUSTOM_LIST: Arbitrary attribute type.
  • SYSTEM_LIST: Product list, type_name: product.
multivalued Determines whether the attribute can have multiple values.
humanized Attribute name.

Sample request

POST https://api-metrika.yandex.net/cdp/api/v1/counter/{counterId}/schema/attributes?entity_type=CONTACT

Response format


{
    "success" :  < boolean > 
}
Parameters Description
success Result of performing the action.
Parameters Description
success Result of performing the action.