Creating REST Resources for CRUD Operations

CRUD operations on the web service configurations are performed by invoking RESTful web services that have been created as part of the cmssmartedit project. The REST service represents data in the form of an array of configurations, where each configuration is a key-value pair with a unique identifier.

The following code excerpt shows a sample configuration of the Configuration Editor:
{"value":"/previewwebservices/v1/preview","key":"previewTicketURI"}

Once you have started the SAP Commerce Cloud platform, you can access the REST resource at /smartedit/configuration/.

The REST service for configurations provides support for all CRUD operations, for example:

  • Create: Create and add a new configuration by invoking a POST request to the service with a key-value pair as data.

  • Read: Read all the configurations by invoking a GET request to the service, which returns a list of configurations.

  • Update:Update a configuration by invoking a PUT request to the service with the update configuration (key-value) as data, for example, a PUT request on /smartedit/configuration/123 will update the configuration with key 123.

  • Delete: Delete a specified configuration by invoking a DELETE request to the service with the configuration (key-value) to be deleted as data, for example: DELETE request on/smartedit/configuration/123 will delete the configuration with key 123.

The following figure shows how a high-level view of REST implementation for the configurations: