Skip to content

REST API

mweikard edited this page Nov 5, 2018 · 5 revisions

API

The server application provies a simple REST like API for accessing CoreMedia content resources. The API can be tested by using the builtin Swagger UI at the following URL:

http://<app-host>:<app-port>/swagger-ui.html

Accessing Sites

/caas/v1/{tenantId}/sites/{siteId}

/caas/v1/{tenantId}/sites/{siteId}/{viewName}

Path parameters:

Name Type Value Comment
tenantId String Identifies a set of sites belonging to a specific tenant The tenant ID is configured in the local settings of a site document.
siteId String Identifies a specific site from the set of tenant sites The ID property of the site document.
viewName String Optional view name of a GraphQL query Defaults to default if not provided.

Applies the GraphQL query with the fixed name sites and view matching the given parameter viewName to the resolved site document. See Queries comment header for defining a queries name and view.

Accessing Content

/caas/v1/{tenantId}/sites/{siteId}/{queryName}/{targetId}

/caas/v1/{tenantId}/sites/{siteId}/{queryName}/{targetId}/{viewName}

Path parameters:

Name Type Value Comment
tenantId String Identifies a set of sites belonging to a specific tenant The tenant ID is configured in the local settings of a site document.
siteId String Identifies a specific site from the set of tenant sites The ID property of the site document.
queryName String Name of the GraphQL query Name defined in the query comment header.
targetId Integer/String Numerical ID or alias name of the CoreMedia content Alias names can be defined by assigning a struct with link properties named caas.mappings to the queried site (either as local or linked setting). A link property's key defines the alias name.
viewName String Optional view name of a GraphQL query Defaults to default if not provided.

Applies the GraphQL query with the name queryName and view viewName to the resolved content object. See Queries comment header for defining a queries name and view.

Accessing Media Properties

/caas/v1/{tenantId}/sites/{siteId}/media/{mediaId}/{propertyName}

/caas/v1/{tenantId}/sites/{siteId}/media/{mediaId}/{propertyName}/{mediaHash}

Path parameters:

Name Type Value Comment
tenantId String Identifies a set of sites belonging to a specific tenant The tenant ID is configured in the local settings of a site document.
siteId String Identifies a specific site from the set of tenant sites The ID property of the site document.
mediaId Integer Numerical ID if the CoreMedia content
propertyName String Blob property name
mediaHash String Optional computed hash for the media object The hash can be added if it is required to cache the binary data externally, e.g. via CDN, and to apply very long cache times. The hashes change if the content or transformation rules change.

Media hashes are enabled by setting the configuration property caas.binary-uri-hashes-enabled to true.

Optional query parameters for type CMPicture:

Name Type Value
ratio String Ratio alias defined in the responsive image settings.
minWidth Integer Minimum requested width of the image. Only applies if a ratio is given.
minHeight Integer Minimum requested height of the image. Only applies if a ratio is given.

Responsive image settings must be sorted ascending by resolution (per ratio) for proper selection of minWidth and maxWidth.

Accessing The Image Transformation Map

/caas/v1/{tenantId}/sites/{siteId}/media/image/variants

Path parameters:

Name Type Value Comment
tenantId String Identifies a set of sites belonging to a specific tenant The tenant ID is configured in the local settings of a site document.
siteId String Identifies a specific site from the set of tenant sites The ID property of the site document.

Examples

If you imported the sample data for the React fragment client, try these URLs:

http://<app-host>:<app-port>/caas/v1/coremedia/sites/caassiopeia-en-DE/navigation
http://<app-host>:<app-port>/caas/v1/coremedia/sites/caassiopeia-en-DE/teasables/home.hero
http://<app-host>:<app-port>/caas/v1/coremedia/sites/caassiopeia-en-DE/teasables/home.teaser-left
http://<app-host>:<app-port>/caas/v1/coremedia/sites/caassiopeia-en-DE/teasables/home.teaser-right
http://<app-host>:<app-port>/caas/v1/coremedia/sites/caassiopeia-en-DE/teasables/home.teaser-bottom
Clone this wiki locally