Skip to main content

Create a Field

POST 

/v2/fields

  • For Commerce, this endpoint creates a field.
  • For Product Experience Manager, this endpoint creates an attribute.

Request

Body

required
    data object
    default number

    Specifies a default value for a field/attribute if no value is provided and the field/attribute is required.

    description string

    A description for a field/attribute.

    enabled boolean
    field_type string

    This field is immutable and cannot be updated. You can have the following field types:

    • string
    • integer
    • boolean
    • float
    • date
    • relationship
    name string

    The name of a field/attribute.

    order number

    Denotes the order in which a field/attribute is returned relative to the rest of flow fields/template attributes.

    relationships object

    Relationships are established between different flow/template entities. For example, a field/attribute is related to a flow/template, as the field/attribute is attached to the flow/template.

    flow object
    data object
    id uuid

    A unique identifier for a resource.

    type string

    Represents the type of object being returned.

    required boolean

    true if required on input, false if not. Always false if the field_type relationship.

    slug string

    A unique identifier of a field/attribute.

    type string

    Represents the type of object being returned.

    validation_rules object[]

    An array of validation rule objects. See Field Validation Rules.

  • Array [
  • type string

    Possible values: [enum, email, slug, between, one-to-many, one-to-one]

    The validation you use depends on the field_type of the field/attribute. Each validation rule is expressed as a validation rule object.

    options object
    anyOf
  • Array [
  • string

  • ]
  • to string
  • ]

Responses

Created

Schema
    data object
    id uuid

    A unique identifier for a resource.

    type string

    Represents the type of object being returned.

    field_type string

    This field is immutable and cannot be updated. You can have the following field types:

    • string
    • integer
    • boolean
    • float
    • date
    • relationship
    slug string

    A short description for a field/attribute.

    name string

    The name of a field/attribute.

    description string

    A short description of a field/attribute.

    required boolean

    true if required on input, false if not. Always false if the field_type is a relationship.

    default numberstringnull

    A default value if none is supplied and a field/attribute is not required.

    enabled boolean
    order numbernull

    Denotes the order in which this field is returned relative to the rest of the flow/template fields/attributes.

    omit_null boolean

    Hide this field/attribute from responses if the value is null.

    validation_rules object[]
  • Array [
  • type string

    Possible values: [enum, email, slug, between, one-to-many, one-to-one]

    The validation you use depends on the field_type of the field/attribute. Each validation rule is expressed as a validation rule object.

    options object
    anyOf
  • Array [
  • string

  • ]
  • to string
  • ]
  • meta object
    owner string

    Possible values: [store, organization]

    The resource owner, either organization or store.

    timestamps object
    created_at string

    The date and time a resource is created.

    updated_at string

    The date and time a resource is updated.

    links object

    Links allow you to move between requests. Single entities use a self parameter with a link to that specific resource. Listing pages use the following:

    PropertyDescription
    currentAlways the current page
    firstAlways the first page
    lastnull if there is only one page.
    prevnull if you are on the first page.
    nextnull if there is only one page.
    self string
    relationships object

    Relationships are established between different flow/template entities. For example, a field/attribute is related to a flow/template, as the field/attribute is attached to the flow/template.

    flow object
    data object
    id uuid

    A unique identifier for a resource.

    type string

    Represents the type of object being returned.

Loading...