Common API Types

The following is a description of common API Types, used within other API resources.

LocalizedString

A localized string is a JSON object where the keys are of ↗ IETF language tag , and the values the corresponding strings used for that language.

{
  "de": "Hundefutter",
  "en": "dog food"
}

Reference

A Reference is a JSON object representing a (loose) reference to another resource on the commercetools™ platform. It consists of two fields:

{
  "typeId": "product",
  "id": "d1229e6f-2b79-441e-b419-180311e52754"
}

Reference Types

Expanded Reference

If a reference is returned by a query endpoint and reference expansion of a certain reference was requested then the reference might contain an additional obj field containing the resource.

ResourceIdentifier

A reference to a resource can be created by providing the ID of the resource. Some resources also use the key as a unique identifier and a reference can be created by providing the key instead of the ID. In this case, the server will find the resource with the given key and use the id of the found resource to create a reference.

The typeId is optional, but if given, it must match the expected reference type of the referenced resource.

ResourceIdentifier by ID

ResourceIdentifier by Key

Money

Money is a JSON object combining a currency and an amount (in cents). It consists of two fields:

{
  "currencyCode": "EUR",
  "centAmount":4200
}

Date

A Date is a JSON string representation of a date without timezone in ISO 8601 format (YYYY-MM-DD), for example:

  "2001-09-11"

Time

A Time is a JSON string representation of a time without timezone in ISO 8601 format (hh:mm:ss.sss), for example:

  "14:00:00.000"

DateTime

A DateTime is a JSON string representation of UTC date & time in ISO 8601 format (YYYY-MM-DDThh:mm:ss.sssZ), for example:

  "2001-09-11T14:00:00.000Z"

Address

An Address is a JSON string representation of a postal address. It consists of the following fields:

Asset

An Asset can be used to represent media assets, such as images, videos or PDFs.
Please find more information about use of Assets in the respective tutorial.
An Asset consists of the following fields:

AssetDraft

AssetSource

An AssetSource is a representation of an Asset in a specific format, e.g. a video in a certain encoding, or an image in a certain resolution.

AssetDimensions

The width and height of the asset source.

GeoJSON Geometry

A GeoJSON Geometry represents a ↗ Geometry Object as defined in the GeoJSON standard.

For the moment, only the ↗ Point type is supported.

Point

comments powered by Disqus