Developer documentation

Field definitions

GET https://app.iteras.dk/api/fields/

The API key must allow "Field definitions".

Lists the fields of the account with ID, name, type, choices and the condition operators each can be filtered with; condition_operator_parameters says which parameters each operator takes. used_for says what a field belongs to.

Parameters

All parameters are optional.

  • id string

    Field IDs, repeating the parameter for each, e.g. id=birthday&id=:Cancellation reason. The ID is either the field name with a colon prepended or if defined the external identifier of the field.

    Remember to URL encode the IDs.

  • used_for string

    Only the fields of one kind of object, e.g. used_for=customer. The kinds are the values the fields come back with in used_for, and the error for an unknown one lists them.

  • include_builtins bool Defaults to false

    Include the built-in fields too, e.g. name and email on a customer, which conditions can filter on as well, e.g. include_builtins=true.

Return value

The data returned is an object with an array of field definitions, possibly empty, like this {"fields": [{"id": "birthday", ...}], "condition_operator_parameters": {...}}. Each field definition object may contain the following attributes:

  • name string
    The field name, e.g. Birthday.
  • id string
    The field id, either the field name with a colon prepended or the external identifier of the field, e.g. birthday. Use it to refer to the field, e.g. as a key in data.
  • type string
    The field type, e.g. text, choice, number, date, bool.
  • used_for string
    What the field belongs to, e.g. customer or subscription, as in the used_for parameter.
  • condition_operators array
    The operators a condition on the field can use, e.g. ["equal", "contains"].
  • choices array

    The choices the field accepts, e.g. [{"name": "Personal", "customer_facing": true}]. Included only for fields with choices.

    • customer_facing bool
      Whether the choice is shown to customers in self-service, e.g. true.
    • name string
      The choice name, e.g. Personal.
    • help_text string
      Explanatory text shown next to the choice, e.g. Choose this if you subscribe yourself. Included if set.
    • identifier string
      The external identifier of the choice, used when setting the field, e.g. personal. Included if set.

condition_operator_parameters has, for each operator, the parameters a condition with it takes besides field and operator, e.g. {"contains": ["text"]}.

{
  "fields": [
    {
      "name": "Title",
      "id": ":Title",
      "type": "text",
      "used_for": "customer",
      "condition_operators": [
        "filledin",
        "notfilledin",
        "contains",
        "notcontains",
        "equal",
        "notequal",
        "oneof",
        "notoneof"
      ]
    },
    {
      "name": "Subscription type",
      "id": ":Subscription type",
      "type": "choice",
      "choices": [
        {
          "customer_facing": true,
          "name": "Personal"
        },
        {
          "customer_facing": true,
          "name": "Business"
        }
      ],
      "used_for": "subscription",
      "condition_operators": [
        "filledin",
        "notfilledin",
        "in",
        "notin"
      ]
    }
  ],
  "condition_operator_parameters": {
    "contains": ["text"],
    // ...
  }
}