The goal of this article is to provide documentations needed when upgrading Swagger SAP Commerce to version 2211.
SAP best practices recommends to use swaggerintegration extension to automate the API documentation process and provide Swagger UI for your web services.
The basic steps to activate Swagger in SAP CC 2211 are
[...]
<extension name="swaggerintegration"/>
[...]
If the swagger is still not working despite the actions above and you have 404 when loading the swagger in the browser
commercewebservices.api.restrictions.disabled.endpoints=.*
commercewebservices.api.restrictions.enabled.endpoints=<ENDPOINTS_METHODS_LISTS_SEPERATED_BY_COMMA>
commercewebservices.api.restrictions.disabled.endpoints=
commercewebservices.api.restrictions.disabled.endpoints=.*
commercewebservices.api.restrictions.enabled.endpoints=openapiJsonUsingGET,redirectToUiUsingGET,<ENDPOINTS_METHODS_LISTS_SEPERATED_BY_COMMA>
After doing this, you will be able to load the swagger correctly with the following address : https://<API_URL>/occ
Below some useful links if you need to do some advanced configurations
Link | Comment |
ApiDocInfoProvider | Check this link to know how you can use the implementation of ApiDocInfoProvider interface to provide information for API Documentation |
Integrate with swaggerintegration Extension | Check this link to know how to integrate with swaggerintegration extension |
Authorization Exclusion | Check this link to see how you can exclude endpoints in your spring security config. |
Customized Servlet Path | Check this link if you have a customised servlet path |
OAuth2 Configuration | Check this link to know which configuration information about OAuth is needed |
Enable/Disable Swagger U | Check this link to know how to enable/disable swagger |
OpenAPI Customizer | Check this link if you want to customise your OpenAPI documentation with Springdoc |
With the information provided above, you will be able to activate swagger API in SAP Commerce 2211 and gain visibility on the APIs exposed by your SAP Commerce implementation