This topic contains best / proven practices for end points for Headless CMS, following User days.
How to handle multiple websites
Novulo Headless CMS and REST API supports multiple websites.
It requires you to provide the website that you are requesting in the end point.
In our experience, the best practice is:
a) To have one end point for all websites. For example /rest/hcms/products_for_tags
b) To have a query parameter for the Website Translation. This allows you to have one parameter that can provide you both the language as well as the website, and thereby the Sales Channel.
c) To use a “Code” field or GUID for the Website translation, that you use to link your front-end to the back-end. Using ID’s works, but between OTAP environments they can differ which makes it not-recommended. GUIDs can also be done, but are more difficult in reading.
Then, for performance reasons, you can use Expression Parameters for your REST Data Definition to create parameters for language, website, sales_channel and sales_price_list to calculate them once and use them everywhere.
Using parameters and pagination
REST End points support pagination, page limiting and parameters.
See this Tango for an explanation about:
a) How to use built-in pagination
b) What does ‘custom response’ do and how to use it
c) How to add parameters with default values
d) How to use parameters to modify the page size in pagination
How to use expression parameters to increase performance and simplify expressions
OpenAPI 3.0.0 and end point cache
There are two special commands for the REST end points
GET /rest/metadata
will provide you an OpenAPI 3.0.0-specification in JSON-format that describes all your end points. Documentation entered in the application at the appropriate fields will also be displayed here.
GET /rest/resetendpointcache
will reset the cache of the end point definition. To save on server load, the definitions of the end points are cached in the IIS server memory. Changes in end points trigger cache purge actions automatically. Nevertheless, this endpoint is available to manually clear the cache. Please note: this is not the same as the end point contents cache.