Skip to main content

Batch endpoint

It allows to retrieve a set of components with a single request to the API. While this should be convenient during the server-side rendering, it is not a good practice for client-side rendering.

Server-side rendering via rest API using the post route

curl http://my-components-registry.mydomain.com/
-X POST
-H "Content-Type: application/json"
-d '{components:[{"name": hello-world", "version": "1.X.X"}, {"name": "my-component", "parameters": { "something": 2345 }}]}'

[{
"status": 200,
"response": {
"href": "https://my-components-registry.mydomain.com/hello-world/1.X.X",
"name": "hello-world",
"version": "1.0.0",
"requestVersion": "1.X.X",
"html": "Hello John doe!",
"type": "oc-component",
"renderMode": "rendered"
}
},{
"status": 200,
"response": {
"href": "https://my-components-registry.mydomain.com/my-component/?something=2345",
"name": "my-component",
"version": "1.0.0",
"requestVersion": "",
"html": "Bla bla",
"type": "oc-component",
"renderMode": "rendered"
}
}]

Payload API

ParameterTypeMandatoryDescription
componentsarray of objectsyesComponents to retrieve
components[index].namestringyesComponent name
components[index].versionstringnoDefault latest, the component's version
components[index].parametersobjectnoComponent's parameters
omitHrefbooleannoDefault false, when true omits the href value in the response of each component
parametersobjectnoGlobal parameters for all components to retrieve. When component has its own parameters, globals will be overwritten