OCAPI Metadata
The Open Commerce API provides data about itself (metadata). You can obtain API metadata by accessing an own API, the meta API. This API can be accessed like the shop and the data API, but with version 1 as API version. The meta API provides information about
- A list of available APIs
- A list of available versions for an API
- A list of resources and their descriptions
- A list of accessible documents
- A description for a single document
To access the Meta API, you have to send an Authorization: Bearer OAuth token with every request, which is obtained via Account Manager. With the client ID, used to create the access token, the access to all resources via OCAPI settings is proofed and only the available resources and documents are shown. The results may differ, depending on the context used to access the metadata. In the context of a specific site, the OCAPI settings of the site are used to check the access rights for the requesting client and show him only the resources he’s allowed to access. The same applies to accessing the metadata in a global context, where the global OCAPI settings are used to retrieve only the metadata the client is allowed to access.
The Meta API responses are cached in the page cache for 24 hours. This means that the cache for the metadata is automatically cleared with page cache clearing.
The following example lists which APIs are available:
The following example lists which API versions are available:
The retrieved document is for using with swagger in version 2.0 and lists all resource paths with their input-parameters and return type descriptions. The following example lists supported resource URIs:
The following example lists all available documents for an API in a specific version:
The following example shows the metadata for a requested document for an API in a specific version:
Also it’s possible to include the child document definitions by adding a query parameter children=embedded: