Skip to content

Enum

An Enum is a named list of values your application offers: shoe sizes, return reasons, the countries you ship to. Every value has a key, a value val of the Enum's valueType, and an optional display order. With valueType: stringLocalized, each value is a list of LanguageTaggedStrings, so a dropdown can show it in the user's language.

Unlike other objects, you choose an Enum's id when you create it, such as ShoeSizes. An id can be used only once: creating a second Enum with the same id, even after the first was deleted, is refused with 409.

JSON Schema · ABAC object type Enum

Example

Create one with POST /enums:

{
  "id": "ReturnReasons",
  "description": "Why a customer returns an item",
  "valueType": "stringLocalized",
  "values": [
    {
      "key": "too-small",
      "order": 1,
      "val": [
        {
          "at_language": "en",
          "at_value": "Too small"
        },
        {
          "at_language": "de",
          "at_value": "Zu klein"
        }
      ]
    },
    {
      "key": "damaged",
      "order": 2,
      "val": [
        {
          "at_language": "en",
          "at_value": "Arrived damaged"
        },
        {
          "at_language": "de",
          "at_value": "Beschädigt angekommen"
        }
      ]
    }
  ]
}

Fields

Required: id, valueType, values.

Field Type Required Description
at_type Enum JSON-LD @type, the object's type name.
at_id URL The object's ObjectsGrid URL, https://apis.objectsgrid.com/<path>/<id>, its JSON-LD @id: what References to it hold. Assigned by ObjectsGrid.
id string Yes The unique identifier for Enum, chosen by you when creating it: 1 to 50 letters, digits, - or _, starting with a letter or a digit. It cannot change, and an id once used cannot be used again.
identifier string The object's id, as Schema.org identifier. Assigned by ObjectsGrid.
url URL The object's own URL, https://apis.objectsgrid.com/<path>/<id>. Assigned by ObjectsGrid.
description string The Enum description
valueType one of boolean, string, stringLocalized, integer, float, dateTime Yes The type of every value: val is a boolean, a string, LanguageTaggedStrings (stringLocalized), an integer, a number (float) or a date-time.
values list of object Yes The Enum values
values[].key string Yes The value key
values[].val any Yes The value, of the Enum valueType
values[].order integer The value position, for display
disabled boolean Is this Enum disabled
tags list of Tag Tags your ABAC policy decides on. Created empty when not sent, kept by a PUT that leaves them out, cleared by null or [].
meta ObjectMeta Read-only metadata: version, type, creation and last update.

REST API

Base URL https://apis.objectsgrid.com. Every request sends the X-ObjectsGrid-AccessPoint and Authorization: Bearer <access token> headers; see the REST API guide.

Operation Request
Create POST /enums
List and search GET /enums
Create up to 100 at once POST /enums/batch
Retrieve GET /enums/{id}
Replace PUT /enums/{id}
Update some fields PATCH /enums/{id}
Delete DELETE /enums/{id}

Enum objects have no JSON-LD document: asked for one (Accept: application/ld+json), GET answers 406.

The OpenAPI contract, with every parameter and response: Enums (JSON).

Webhook events

Subscribe to these events in your webhook configuration to be called when an Enum changes:

EnumCreated, EnumUpdated, EnumPatched, EnumDeleted.