Schema Service

Download OpenAPI specification:Download

Manage the mixins schemas for miscellaneous types.


Key Features

  • Uploading json files to create schemas for an object like product, order, quotes, customer, customer.address, company, coupon, returns, category and price_list.
  • Support for mixins localization.

Key Benefits

  • Easy and quick creation of custom mixins.

Schema

Creating a schema

Creates a schema entity and generates json-schema representation which is then uploaded to cloudinary repository.


Required scopes

  • schema.schema_manage - required for creating a schema
SecurityOAuth2
Request
path Parameters
tenant
required
string [ 3 .. 16 ] characters ^[a-z][a-z0-9]+$

Your Emporix tenant's name.

Note: Always write the tenant name in lowercase.

header Parameters
Content-Language
string

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

Example: de
Request Body schema: application/json
required
Array of objects (SchemaAttribute)

List of attributes related to the schema.

name
required
object

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

types
required
Array of strings (SchemaType)

List of types which schema should be assigned to.

Items Enum: "CATEGORY" "COMPANY" "COUPON" "CUSTOMER" "CUSTOMER.ADDRESS" "ORDER" "PRODUCT" "QUOTE" "RETURN" "PRICE_LIST"
id
string

Identifier of the schema.

Responses
201

The request was successful. The Schema has been created.

400

Unsupported content language provided.

401

Given request is unauthorized - the authorization token is invalid or has expired. It usually means that the tenant from the token does not match tenant from path.

403

Permission denied due to insufficient rights. This may happen when the request does not contain sufficient scopes for the given query values.

409

Conflict.

post/{tenant}/schemas
Request samples
application/json
{
  • "name": {
    },
  • "types": [
    ],
  • "attributes": [
    ]
}
Response samples
application/json
{
  • "id": "e241dc9e-a3f6-4573-bb01-a8ae21d2d4ae"
}

Retrieving all schemas

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

SecurityOAuth2
Request
path Parameters
tenant
required
string [ 3 .. 16 ] characters ^[a-z][a-z0-9]+$

Your Emporix tenant's name.

Note: Always write the tenant name in lowercase.

query Parameters
pageNumber
integer >= 1
Default: 1

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

pageSize
integer >= 1
Default: 60

Number of items to be retrieved per page.

sort
string

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.

q
string

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 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=mixin:exists, where mixin is the field that has a non-empty value.
  • 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:~(Joghurt im) - where name is the product field name, en is the desired language, and Joghurt im is the search term.
Example: q=siteCode:{main}
type
string

Filters schemas by type. Possible types to specify, CATEGORY, COMPANY, COUPON, CUSTOMER, CUSTOMER.ADDRESS, ORDER, PRODUCT, QUOTE, RETURN, PRICE_LIST. 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-Count
boolean
Default: false

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

Example: true
Accept-Language
string

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
200
400

Unsupported language provided.

401

Given request is unauthorized - the authorization token is invalid or has expired. It usually means that the tenant from the token does not match tenant from path.

403

Permission denied due to insufficient rights. This may happen when the request does not contain sufficient scopes for the given query values.

get/{tenant}/schemas
Request samples
Response samples
application/json
[
  • {
    }
]

Retrieving a schema

Retrieves a single schema.

SecurityOAuth2
Request
path Parameters
tenant
required
string [ 3 .. 16 ] characters ^[a-z][a-z0-9]+$

Your Emporix tenant's name.

Note: Always write the tenant name in lowercase.

id
required
string

Unique identifier of the schema.

query Parameters
version
integer

Version of the schema.

Example: version=1
header Parameters
Accept-Language
string

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
200
401

Given request is unauthorized - the authorization token is invalid or has expired. It usually means that the tenant from the token does not match tenant from path.

403

Permission denied due to insufficient rights. This may happen when the request does not contain sufficient scopes for the given query values.

404

Given resource cannot be found.

get/{tenant}/schemas/{id}
Request samples
Response samples
application/json
{
  • "id": "64d35aa7fa54121ca47db657",
  • "name": {
    },
  • "attributes": [
    ],
  • "types": [
    ],
  • "metadata": {}
}

Deleting a schema

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


Required scopes

  • schema.schema_manage
SecurityOAuth2
Request
path Parameters
tenant
required
string [ 3 .. 16 ] characters ^[a-z][a-z0-9]+$

Your Emporix tenant's name.

Note: Always write the tenant name in lowercase.

id
required
string

Unique identifier of the schema.

query Parameters
version
integer

Version of the schema.

Example: version=1
Responses
204

No content

401

Given request is unauthorized - the authorization token is invalid or has expired. It usually means that the tenant from the token does not match tenant from path.

403

Permission denied due to insufficient rights. This may happen when the request does not contain sufficient scopes for the given query values.

delete/{tenant}/schemas/{id}
Request samples
Response samples
application/json
{
  • "fault": {
    }
}

Updating a schema

Updates a single schema. Each update releases a new version of json schema file.

Required scopes

  • schema.schema_manage
SecurityOAuth2
Request
path Parameters
tenant
required
string [ 3 .. 16 ] characters ^[a-z][a-z0-9]+$

Your Emporix tenant's name.

Note: Always write the tenant name in lowercase.

id
required
string

Unique identifier of the schema.

query Parameters
version
integer

Version of the schema.

Example: version=1
header Parameters
Content-Language
string

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

Example: de
Request Body schema: application/json
required
Array of objects (SchemaAttribute)

List of attributes related to the schema.

name
required
object

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

types
required
Array of strings (SchemaType)

List of types which schema should be assigned to.

Items Enum: "CATEGORY" "COMPANY" "COUPON" "CUSTOMER" "CUSTOMER.ADDRESS" "ORDER" "PRODUCT" "QUOTE" "RETURN" "PRICE_LIST"
object (SchemaMetadataUpdate)
Responses
204

No content

400

Unsupported content language provided.

401

Given request is unauthorized - the authorization token is invalid or has expired. It usually means that the tenant from the token does not match tenant from path.

403

Permission denied due to insufficient rights. This may happen when the request does not contain sufficient scopes for the given query values.

404

Given resource cannot be found.

409

Conflict.

put/{tenant}/schemas/{id}
Request samples
application/json
{
  • "name": {
    },
  • "types": [
    ],
  • "attributes": [
    ],
  • "metadata": {
    }
}
Response samples
application/json
{
  • "code": 400,
  • "status": "Bad Request",
  • "message": "Language header validation failed.",
  • "details": [
    ]
}

Providing a file

Validates and parses provided json schema file. When the file is valid, it returns a json which can be used either to create a new schema via POST operation or to update an existing one via PUT operation when all the missing fields are provided. It doesn't create any file and it doesn't crease a database entity.

SecurityOAuth2
Request
path Parameters
tenant
required
string [ 3 .. 16 ] characters ^[a-z][a-z0-9]+$

Your Emporix tenant's name.

Note: Always write the tenant name in lowercase.

Request Body schema: multipart/form-data
file
required
object <json>

Content of the file.

id
string

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.

400

Unsupported content language provided.

401

Given request is unauthorized - the authorization token is invalid or has expired. It usually means that the tenant from the token does not match tenant from path.

403

Permission denied due to insufficient rights. This may happen when the request does not contain sufficient scopes for the given query values.

post/{tenant}/schemas/file
Request samples
Response samples
application/json
{
  • "id": "64d35aa7fa54121ca47db657",
  • "name": {
    },
  • "attributes": [
    ],
  • "metadata": {
    }
}

Type

Updating types of a schema

Updates assigned types to the schema. It's allowed to change the assigned types to the newest schema as well as to the previous versions of the schema. This operation does not generate a new version of the schema.

Required scopes

  • schema.schema_manage
SecurityOAuth2
Request
path Parameters
tenant
required
string [ 3 .. 16 ] characters ^[a-z][a-z0-9]+$

Your Emporix tenant's name.

Note: Always write the tenant name in lowercase.

id
required
string

Unique identifier of the schema.

query Parameters
version
required
integer

Version of the schema.

mode
string
Default: "REPLACE"

Defines how types assigned to given schema should be resolved. REPLACE is a default value. REPLACE takes provided types and replaces the existing ones with it. ADD adds provided types to the existing ones. REMOVE removes provided types from the existing ones.

Enum: "REPLACE" "ADD" "REMOVE"
Request Body schema: application/json
Array
string (SchemaType)

Type which the schema should be assigned to.

Enum: "CATEGORY" "COMPANY" "COUPON" "CUSTOMER" "CUSTOMER.ADDRESS" "ORDER" "PRODUCT" "QUOTE" "RETURN" "PRICE_LIST"
Responses
204

No content

400

Unsupported content language provided.

401

Given request is unauthorized - the authorization token is invalid or has expired. It usually means that tenant from the token does not match tenant from path.

403

Permission denied due to insufficient rights. This may happen when the request does not contain sufficient scopes for the given query values.

404

Given resource cannot be found.

put/{tenant}/schemas/{id}/types
Request samples
application/json
[
  • "PRODUCT",
  • "ORDER"
]
Response samples
application/json
{
  • "code": 400,
  • "status": "Bad Request",
  • "message": "Language header validation failed.",
  • "details": [
    ]
}

Retrieving types

Retrieves types which have at least one schema assigned.

SecurityOAuth2
Request
path Parameters
tenant
required
string [ 3 .. 16 ] characters ^[a-z][a-z0-9]+$

Your Emporix tenant's name.

Note: Always write the tenant name in lowercase.

Responses
200
401

Given request is unauthorized - the authorization token is invalid or has expired. It usually means that the tenant from the token does not match tenant from path.

403

Permission denied due to insufficient rights. This may happen when the request does not contain sufficient scopes for the given query values.

get/{tenant}/types
Request samples
Response samples
application/json
[
  • "ORDER",
  • "PRODUCT",
  • "QUOTE"
]

Reference

Creating a reference

Creates a reference entity and uploads provided file to the cloudinary repository.


Required scopes

  • schema.schema_manage - required for creating a reference
SecurityOAuth2
Request
path Parameters
tenant
required
string [ 3 .. 16 ] characters ^[a-z][a-z0-9]+$

Your Emporix tenant's name.

Note: Always write the tenant name in lowercase.

header Parameters
Content-Language
string

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

Example: de
Request Body schema: multipart/form-data
file
required
object <json>

Content of the file.

required
object (ReferenceCreation)
Responses
201

The request was successful. The Reference has been created.

400

Unsupported content language provided.

401

Given request is unauthorized - the authorization token is invalid or has expired. It usually means that the tenant from the token does not match tenant from path.

403

Permission denied due to insufficient rights. This may happen when the request does not contain sufficient scopes for the given query values.

409

Conflict.

post/{tenant}/references
Request samples
multipart/form-data
{
  "file": {
    "externalValue": "https://res.cloudinary.com/saas-ag/raw/upload/schemata2/saastest2/653a30c0951b2b0665884f89_v1.json"
  },
  "body": {
    "name": {
      "en": "Product Custom Attributes"
    },
    "types": [
      "PRODUCT"
    ]
  }
}
Response samples
application/json
{
  • "id": "e241dc9e-a3f6-4573-bb01-a8ae21d2d4ae"
}

Retrieving all references

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

SecurityOAuth2
Request
path Parameters
tenant
required
string [ 3 .. 16 ] characters ^[a-z][a-z0-9]+$

Your Emporix tenant's name.

Note: Always write the tenant name in lowercase.

query Parameters
pageNumber
integer >= 1
Default: 1

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

pageSize
integer >= 1
Default: 60

Number of items to be retrieved per page.

sort
string

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.

q
string

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 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=mixin:exists, where mixin is the field that has a non-empty value.
  • 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:~(Joghurt im) - where name is the product field name, en is the desired language, and Joghurt im is the search term.
Example: q=siteCode:{main}
type
string

Filters references by type. Possible types to specify, CATEGORY, COMPANY, COUPON, CUSTOMER, CUSTOMER.ADDRESS, ORDER, PRODUCT, QUOTE, RETURN, PRICE_LIST. When the newer version of a reference 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-Count
boolean
Default: false

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

Example: true
Accept-Language
string

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
200
400

Unsupported language provided.

401

Given request is unauthorized - the authorization token is invalid or has expired. It usually means that the tenant from the token does not match tenant from path.

403

Permission denied due to insufficient rights. This may happen when the request does not contain sufficient scopes for the given query values.

get/{tenant}/references
Request samples
Response samples
application/json
[]

Retrieving a reference

Retrieves a single reference.

SecurityOAuth2
Request
path Parameters
tenant
required
string [ 3 .. 16 ] characters ^[a-z][a-z0-9]+$

Your Emporix tenant's name.

Note: Always write the tenant name in lowercase.

id
required
string

Unique identifier of the schema.

query Parameters
version
integer

Version of the schema.

Example: version=1
header Parameters
Accept-Language
string

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
200
401

Given request is unauthorized - the authorization token is invalid or has expired. It usually means that the tenant from the token does not match tenant from path.

403

Permission denied due to insufficient rights. This may happen when the request does not contain sufficient scopes for the given query values.

404

Given resource cannot be found.

get/{tenant}/references/{id}
Request samples
Response samples
application/json
{}

Deleting a reference

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


Required scopes

  • schema.schema_manage
SecurityOAuth2
Request
path Parameters
tenant
required
string [ 3 .. 16 ] characters ^[a-z][a-z0-9]+$

Your Emporix tenant's name.

Note: Always write the tenant name in lowercase.

id
required
string

Unique identifier of the schema.

query Parameters
version
integer

Version of the schema.

Example: version=1
Responses
204

No content

401

Given request is unauthorized - the authorization token is invalid or has expired. It usually means that the tenant from the token does not match tenant from path.

403

Permission denied due to insufficient rights. This may happen when the request does not contain sufficient scopes for the given query values.

delete/{tenant}/references/{id}
Request samples
Response samples
application/json
{
  • "fault": {
    }
}

Updating a reference

Updates a single reference.

Required scopes

  • schema.schema_manage
SecurityOAuth2
Request
path Parameters
tenant
required
string [ 3 .. 16 ] characters ^[a-z][a-z0-9]+$

Your Emporix tenant's name.

Note: Always write the tenant name in lowercase.

id
required
string

Unique identifier of the schema.

query Parameters
version
integer

Version of the schema.

Example: version=1
header Parameters
Content-Language
string

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

Example: de
Request Body schema: multipart/form-data
file
required
object <json>

Content of the file.

required
object (ReferenceUpdate)
Responses
204

No content

400

Unsupported content language provided.

401

Given request is unauthorized - the authorization token is invalid or has expired. It usually means that the tenant from the token does not match tenant from path.

403

Permission denied due to insufficient rights. This may happen when the request does not contain sufficient scopes for the given query values.

404

Given resource cannot be found.

409

Conflict.

put/{tenant}/references/{id}
Request samples
multipart/form-data
{
  "file": {
    "externalValue": "https://res.cloudinary.com/saas-ag/raw/upload/schemata2/saastest2/653a30c0951b2b0665884f89_v1.json"
  },
  "body": {
    "name": {
      "en": "Product Custom Attributes"
    },
    "types": [
      "PRODUCT"
    ],
    "metadata": {
      "version": 1
    }
  }
}
Response samples
application/json
{
  • "code": 400,
  • "status": "Bad Request",
  • "message": "Language header validation failed.",
  • "details": [
    ]
}