Challenge: Prototyping APIs
Practice converting the Credit-Check sketch into an API prototype using the OpenAPI Specification format.
We'll cover the following
Exercise
In this exercise, convert the Credit-Check sketch into an API prototype using the OpenAPI Specification format. Create a working prototype of the Credit-Check API that can be used as a reference.
- To start, log in to the WSD editor at https://www.websequencediagrams.com to create a new WSD document that reflects the translation of
credit-check-alps
andcredit-check-diagram.wsd
into an HTTP-style API. This is the creative part of this challenge. There’s no right or wrong answer. Once you’re done, export your PNG and text versions of the WSD diagram.
Note: You can see
credit-check-alps.json
andcredit-check-diagram.wsd
in the terminal below by executing thecat <file-name>
command.
-
Next, log in to your account at SwaggerHub (https://swaggerhub.com) and start a new version 3 OAS document named
creditcheck-api
using the same defaults we used previously. Next, using the components template and the path template, fill out the Credit-Check prototype with all the parameters, request bodies, responses, and schemas that’ll be needed to complete thepaths
section of the OAS document. When you’re done with this step, you should have a fully defined Credit-Check API. -
Next, use the SwaggerHub mocking service to run some simple tests on your interface. If needed, perform any minor bug fixes or interface changes. Once you are done making any changes to the OAS document, export the API definition as both a “YAML Unresolved” and a “YAML Resolved” output. Extract the JSON and YAML documents from the ZIP file and, along with the unresolved YAML file.
-
Finally, set up a folder for your API technical documentation and use the ReDocly HTML template (https://github.com/Redocly/redoc) to create your own interactive API documentation for your Credit-Check API.
Get hands-on with 1200+ tech skills courses.