Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Schema

Retrieving all schemas

get

Retrieves all schemas. You can filter the results with query parameters.

Authorizations
OAuth2clientCredentialsRequired
Token URL:
Path parameters
tenantstring · min: 3 · max: 16Required

Your Emporix tenant name.

Note: Always write the tenant name in lowercase.

Pattern: ^[a-z][a-z0-9]+$
Query parameters
pageNumberinteger · min: 1Optional

Page number to be retrieved. The number of the first page is 1.

Default: 1
pageSizeinteger · min: 1Optional

Number of items to be retrieved per page.

Default: 60
sortstringOptional

List of properties used to sort the results, separated by colons. The order of properties indicates their priority in sorting.

Possible values:

  • {fieldName}
  • {fieldName}:asc
  • {fieldName}:desc

Note: If you want to sort the results by localized properties, the possible values are:

  • {fieldName}.{language}
  • {fieldName}.{language}:asc
  • {fieldName}.{language}:desc

If the sorting direction is not specified, the fields are sorted in ascending order.

qstringOptional

A standard query parameter is used to search for specific values.

  • Searching for items by string-based properties:
    • By a field value: q=siteCode:main, where siteCode is the field name, and main is its desired value.
    • By a value that is not equal to the specified value: q=id:!=64d35aa7fa54121ca47db657, where id is the field name, and 64d35aa7fa54121ca47db657 is the excluded schema ID.
    • By a localized field value: q=items.product.name.en:apple_lobo, where name is the field name of product, en is the language code, and apple_lobo is the field value expressed in the specified language. Note: This query works only for localized fields, which are stored in a map format, where key is the language code and value is the translation to particular language.
  • Searching for items by a number-based property:
    • With a specific value: q=items.quantity.quantity:20
    • With a value greater than: q=items.quantity.quantity:>20
    • With a value lower than: q=items.quantity.quantity:<20
    • With a value greater than or equal to: q=items.quantity.quantity:>=20
    • With a value lower than or equal to: q=items.quantity.quantity:<=20
    • With a value within a range of values: q=items.quantity.quantity:(>=10 AND <=20)
      where items.quantity.quantity is the name of the number-based field, and 20 is its querying value.
  • Searching for items by a date-based property: All number-based property queries are also valid for dates. In that case, the date should be placed within double quotes: q=metadataCreatedAt:(>="2021-05-18T07:27:27.455Z" AND <"2021-05-20T07:27:27.455Z")
  • Searching for items by a boolean-based property: q=description.multiLanguage:true, where description.multiLanguage is the boolean field name, and true is its desired value.
  • Searching for items with a nonexistent or empty property: q=description.en:null, where description.en is the field that has its value set to null.
  • Searching for items with an existing property: q=mixins.mixinName:exists, where the specific mixin named mixinName exists in the database.
  • Searching for items by multiple specific values: q=id:(5c3325baa9812100098ff48f,5c3325d1a9812100098ff494), where id is the field name, and strings within the bracket are the desired values.
  • Searching for items by multiple fields: q=id:5c3325baa9812100098ff48f siteCode:main where id and siteCode are field names. All objects that contain the specified values are returned. Multiple fields (separated by space) can be specified. Multiple values for each field can also be specified in the format presented earlier.
  • Searching for items with string-based properties conforming to a regex: q=siteCode:~ain or q=code:(~U PL) - in case of searching for strings with space, where siteCode is the name of the field, and ain or U PL is its querying regex.
  • Searching for items with a localized string-based property conforming to a regex: items.product.name.en:~(Yoghurt im) - where name is the product field name, en is the desired language, and Joghurt im is the search term.

See: Standard Practices - Query parameter

Example: siteCode:{main}
fieldsstringOptional

Fields to be included in the response.

typestringOptional

Filters schemas by type. Possible types to specify, AVAILABILITY, CART, CART_ITEM, CATEGORY, COMPANY, COUPON, CUSTOMER, CUSTOMER_ADDRESS, LOCATION, ORDER, ORDER_ENTRY, PRODUCT, QUOTE, RETURN, PRICE_LIST, SITE, CUSTOM_ENTITY, VENDOR, VENDOR_LOCATION, MEDIA. When the newest version of the schema is of different type than the previous one and the previous one matches the type specified in this query param, then the previous version is returned.

Header parameters
X-Total-CountbooleanOptional

Flag indicating whether the total number of retrieved items should be returned.

Default: falseExample: true
Accept-LanguagestringOptional

List of language codes acceptable for the response. You can specify factors that indicate which language should be retrieved if the one with a higher factor was not found in the localized fields. If a value is specified, then it must be present in the tenant configuration.

  • If the header is set to a particular language or a list of languages, all localized fields are retrieved as strings.
  • If the header is set to *, all localized fields are retrieved as maps of translations, where the keys are language codes and values are the fields in their respective languages.
  • If the header is empty, localized fields are retrieved in the default language defined in the Configuration Service.
Responses
200Success
application/json
get/schema/{tenant}/schemas
GET /schema/{tenant}/schemas HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Accept: */*
[
  {
    "id": "64d35aa7fa54121ca47db657",
    "name": {
      "en": "Product Custom Attributes"
    },
    "attributes": [
      {
        "key": "weight",
        "name": {
          "en": "Weight of a product"
        },
        "description": {
          "en": "The exact weight of a product in grams."
        },
        "type": "NUMBER",
        "metadata": {
          "readOnly": true,
          "localized": false,
          "required": true
        }
      }
    ],
    "types": [
      "PRODUCT"
    ],
    "siteAware": true,
    "metadata": {
      "version": 1,
      "createdAt": "2023-08-09T09:21:42.693Z",
      "modifiedAt": "2023-08-09T09:21:42.693Z",
      "url": "https://res.cloudinary.com/saas-ag/raw/upload/emporix-docs/64d35aa7fa54121ca47db657_v1.json"
    }
  }
]

Creating a schema

post

Creates a schema entity and generates a JSON Schema representation which is then uploaded to the Cloudinary repository.

Set siteAware to true when custom instances or products that use this mixin may store per-site overlays. Overlay keys use the form {mixinName}__{siteCode}. On custom instances, only schemas with siteAware: true accept those overlay keys.

The tenant's languageSchemaVersion configuration determines how localized attributes are generated. Set that Configuration Service key to v2 before you send localized OBJECT attributes. See Creating configurations and Updating a configuration. The following rules apply:

  • With v2, localized TEXT attributes use language maps. Localized OBJECT attributes use maps whose keys are BCP 47 language tags and whose values are nested objects. Localized TEXT or OBJECT array items use the same v2 map shapes.

  • With v1, or when the configuration is missing, localized TEXT attributes use [{language,value}] arrays and localized OBJECT attributes are rejected.

A localized OBJECT can be nested under a plain OBJECT, but it cannot contain another localized attribute anywhere in its subtree.

Required scopes
This endpoint requires the following scopes:
  • : Required for managing schemas.
Authorizations
OAuth2clientCredentialsRequired
Token URL:
Path parameters
tenantstring · min: 3 · max: 16Required

Your Emporix tenant name.

Note: Always write the tenant name in lowercase.

Pattern: ^[a-z][a-z0-9]+$
Header parameters
Content-LanguagestringOptional

The Content-Language request HTTP header defines language(s) of the payload.

Example: de
Body
nameobjectRequired

Localized schema name in a form of a map of translations.

siteAwareboolean · nullableOptional

When true, custom instances or products that use this mixin may store per-site overlays under keys in the form {mixinName}__{siteCode}. On custom-instance writes, overlay keys are rejected when this flag is not true. Product Service does not enforce this flag on product writes. If omitted or set to null, the value behaves like false.

idstringOptional

Identifier of the schema.

Responses
201

The request was successful. The Schema has been created.

application/json

Id of the created schema.

idstringOptional

ID of the generated document.

post/schema/{tenant}/schemas
POST /schema/{tenant}/schemas HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 685

{
  "name": {
    "en": "Product Custom Attributes"
  },
  "types": [
    "PRODUCT"
  ],
  "attributes": [
    {
      "key": "weight",
      "name": {
        "en": "Weight of a product"
      },
      "description": {
        "en": "The exact weight of a product in grams."
      },
      "type": "TEXT",
      "metadata": {
        "readOnly": true,
        "required": true
      }
    },
    {
      "key": "size",
      "name": {
        "en": "Size of a product"
      },
      "description": {
        "en": "The exact size of a product. Possible values are S, M, L."
      },
      "type": "ENUM",
      "metadata": {
        "readOnly": true,
        "required": true
      },
      "values": [
        {
          "value": "S"
        },
        {
          "value": "M"
        },
        {
          "value": "L"
        }
      ]
    },
    {
      "key": "advertisement",
      "name": {
        "en": "Advertisement of a product"
      },
      "description": {
        "en": "A localized advertisement of a product."
      },
      "type": "TEXT",
      "metadata": {
        "localized": true,
        "required": true
      }
    }
  ]
}
{
  "id": "e241dc9e-a3f6-4573-bb01-a8ae21d2d4ae"
}

Retrieving a schema

get

Retrieves a single schema.

Authorizations
OAuth2clientCredentialsRequired
Token URL:
Path parameters
tenantstring · min: 3 · max: 16Required

Your Emporix tenant name.

Note: Always write the tenant name in lowercase.

Pattern: ^[a-z][a-z0-9]+$
idstringRequired

Unique identifier of the entity.

Query parameters
versionintegerOptional

Version of the entity.

Example: 1
Header parameters
Accept-LanguagestringOptional

List of language codes acceptable for the response. You can specify factors that indicate which language should be retrieved if the one with a higher factor was not found in the localized fields. If a value is specified, then it must be present in the tenant configuration.

  • If the header is set to a particular language or a list of languages, all localized fields are retrieved as strings.
  • If the header is set to *, all localized fields are retrieved as maps of translations, where the keys are language codes and values are the fields in their respective languages.
  • If the header is empty, localized fields are retrieved in the default language defined in the Configuration Service.
Responses
200Success
application/json
idstringOptional

Identifier of the schema.

nameobjectOptional

Localized schema name in a form of a map of translations.

siteAwareboolean · nullableOptional

When true, custom instances or products that use this mixin may store per-site overlays under keys in the form {mixinName}__{siteCode}. Historical schemas may omit the field (null), which behaves like false.

get/schema/{tenant}/schemas/{id}
GET /schema/{tenant}/schemas/{id} HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Accept: */*
{
  "id": "64d35aa7fa54121ca47db657",
  "name": {
    "en": "Product Custom Attributes"
  },
  "attributes": [
    {
      "key": "weight",
      "name": {
        "en": "Weight of a product"
      },
      "description": {
        "en": "The exact weight of a product in grams."
      },
      "type": "NUMBER",
      "metadata": {
        "readOnly": true,
        "localized": false,
        "required": true
      }
    }
  ],
  "types": [
    "PRODUCT"
  ],
  "siteAware": false,
  "metadata": {
    "version": 1,
    "createdAt": "2023-08-09T09:21:42.693Z",
    "modifiedAt": "2023-08-09T09:21:42.693Z",
    "url": "https://res.cloudinary.com/saas-ag/raw/upload/emporix-docs/64d35aa7fa54121ca47db657_v1.json"
  }
}

Updating a schema

put

Updates a single schema. Each update releases a new version of the JSON Schema file.

You can set or clear siteAware on update. The flag is versioned with the schema attributes snapshot.

The tenant's languageSchemaVersion configuration applies the same localized attribute generation rules as when creating a schema.

When languageSchemaVersion is v2, updating a schema regenerates localized TEXT and OBJECT array items as v2 language maps. Migrate stored [{language,value}] array values to language maps before validating them against the new schema version.

Required scopes
This endpoint requires the following scopes:
  • : Required for managing schemas.
Authorizations
OAuth2clientCredentialsRequired
Token URL:
Path parameters
tenantstring · min: 3 · max: 16Required

Your Emporix tenant name.

Note: Always write the tenant name in lowercase.

Pattern: ^[a-z][a-z0-9]+$
idstringRequired

Unique identifier of the entity.

Query parameters
versionintegerOptional

Version of the entity.

Example: 1
Header parameters
Content-LanguagestringOptional

The Content-Language request HTTP header defines language(s) of the payload.

Example: de
Body
nameobjectRequired

Localized schema name in a form of a map of translations.

siteAwareboolean · nullableOptional

When true, custom instances or products that use this mixin may store per-site overlays under keys in the form {mixinName}__{siteCode}. On custom-instance writes, overlay keys are rejected when this flag is not true. Product Service does not enforce this flag on product writes. If omitted or set to null, the value behaves like false.

Responses
204

No content

No content

put/schema/{tenant}/schemas/{id}
PUT /schema/{tenant}/schemas/{id} HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 710

{
  "name": {
    "en": "Product Custom Attributes"
  },
  "types": [
    "PRODUCT"
  ],
  "attributes": [
    {
      "key": "weight",
      "name": {
        "en": "Weight of a product"
      },
      "description": {
        "en": "The exact weight of a product in grams."
      },
      "type": "TEXT",
      "metadata": {
        "readOnly": true,
        "required": true
      }
    },
    {
      "key": "size",
      "name": {
        "en": "Size of a product"
      },
      "description": {
        "en": "The exact size of a product. Possible values are S, M, L."
      },
      "type": "ENUM",
      "metadata": {
        "readOnly": true,
        "required": true
      },
      "values": [
        {
          "value": "S"
        },
        {
          "value": "M"
        },
        {
          "value": "L"
        }
      ]
    },
    {
      "key": "advertisement",
      "name": {
        "en": "Advertisement of a product"
      },
      "description": {
        "en": "A localized advertisement of a product."
      },
      "type": "TEXT",
      "metadata": {
        "localized": true,
        "required": true
      }
    }
  ],
  "metadata": {
    "version": 1
  }
}

No content

Deleting a schema

delete

Deletes a single schema. It deletes just a database entry. The cloudinary reference file remains untouched.

Required scopes
This endpoint requires the following scopes:
  • : Required for managing schemas.
Authorizations
OAuth2clientCredentialsRequired
Token URL:
Path parameters
tenantstring · min: 3 · max: 16Required

Your Emporix tenant name.

Note: Always write the tenant name in lowercase.

Pattern: ^[a-z][a-z0-9]+$
idstringRequired

Unique identifier of the entity.

Query parameters
versionintegerOptional

Version of the entity.

Example: 1
Responses
204

No content

No content

delete/schema/{tenant}/schemas/{id}
DELETE /schema/{tenant}/schemas/{id} HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Accept: */*

No content

Providing a file

post

Validates and parses a provided JSON Schema file. When the file is valid, the endpoint returns a JSON representation that you can complete and use to create or update a schema. It does not create a file or a database entity.

The parser recognizes v2 localized TEXT fields that reference languageValue_v2.json or languageValueNullable_v2.json, including references used as array items. It also recognizes localized OBJECT language maps defined with patternProperties, including localized OBJECT array items.

When you use the parsed representation to create or update a schema with languageSchemaVersion set to v2, Schema Service preserves these v2 localized shapes.

Authorizations
OAuth2clientCredentialsRequired
Token URL:
Path parameters
tenantstring · min: 3 · max: 16Required

Your Emporix tenant name.

Note: Always write the tenant name in lowercase.

Pattern: ^[a-z][a-z0-9]+$
Body
fileobject · jsonRequired

Content of the file.

idstringOptional

Id of the existing schema. Should be null when there is no existing schema.

Responses
200

The request was successful. The file was validated and parsed correctly.

application/json
idstringOptional

Identifier of the schema.

post/schema/{tenant}/schemas/file
POST /schema/{tenant}/schemas/file HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Content-Type: multipart/form-data
Accept: */*
Content-Length: 23

{
  "file": {},
  "id": "text"
}
{
  "id": "64d35aa7fa54121ca47db657",
  "attributes": [
    {
      "key": "address",
      "type": "OBJECT",
      "metadata": {
        "localized": true,
        "nullable": true
      },
      "attributes": [
        {
          "key": "city",
          "type": "TEXT",
          "metadata": {
            "localized": false
          }
        }
      ]
    },
    {
      "key": "labels",
      "type": "ARRAY",
      "metadata": {
        "localized": false
      },
      "arrayType": {
        "type": "TEXT",
        "localized": true
      }
    },
    {
      "key": "contentBlocks",
      "type": "ARRAY",
      "metadata": {
        "localized": false
      },
      "arrayType": {
        "type": "OBJECT",
        "localized": true,
        "attributes": [
          {
            "key": "title",
            "type": "TEXT",
            "metadata": {
              "localized": false
            }
          }
        ]
      }
    }
  ],
  "metadata": {
    "version": 1
  }
}

Last updated

Was this helpful?