Appendix B SAmple Code API Specification and API Mocking Let’s start with developing and mocking API using Swagger UI. An API consumer of the application can use this specification to develop their solution by mocking the services till development phase. This specification is the contract between the API consumer and provider, which helps them to integrate the application in a production environment. You can download the Swagger designer from the following locations. We have used OpenAPI-Specification Version 2. • https://swagger.io/ • https://github.com/swagger-api • https://github.com/OAI/OpenAPI-Specification/blob/master/ versions/2.0.md Swagger-UI You can access the API specification by using Swagger-UI. Step 0: Open the Mocking_Services\swagger-ui folder in the source code. Clone Swagger UI: https://github.com/swagger-api/swagger- ui Step 1: Clone Swagger UI using the following command: git clone https://github.com/swagger-api/swagger-ui.git Step 2: Run “npm install”; you need an open Internet connection because this command will copy the dependency from the NPM repository to your local machine. Step 3: Run “npm start”; when the server starts, it will be running on port number 3002. Access the following URL: http://localhost:3002 339

Building Digital Experience Platforms - Page 349 Building Digital Experience Platforms Page 348 Page 350