Introduction to OpenAPI with Apicurio
Video
Katacoda Scenario
Lab Instructions
In this lab we will look at managing an OpenAPI spec using Apicurio.
- Open a web browser and navigate to https://www.apicur.io/
- Select the
Try Live
button - Login using preferred method
- Select APIs on the left and select
Create New API
in the sub menu - Enter a name and description for the new API
- Select
Blank API
for the template and clickCreate API
- This will take you to the landing page for your new API, at this point we are going to click
Edit API
- Update the Contact and License info in the Design tab
- Add a default Tag Definition of todo
- Select the
add a server
option under the Servers section. Set the Server URL to be localhost:8080 - The completed design tab should look similar to this:
- Click on the
+
button next toData Types
to add a new data type to the API - Enter
Todo
for the Name, and for the JSON example paste the following:json{ "name": "Todo item", "description": "Description of item", "date": "2018-05-06T18:25:43.511Z", "completed": true }
- Under the
Choose to create a REST Resource
section, select theREST Resource
option and clickSave
TIP
Two paths have been automatically generated for the new Todo data type
- Select the Todo data type
- Under
Properties
in the Design tab, select the+
button - Add a new property for an id by typing
id
in the Name field - Under the
Enter Type Information
section, set the Property to beNot Required
and of typeString
, clicksave
- Select the
Source
tab to view the yaml source of the Todo type, note the added id property - Under the
/todos
path, select the GET operation, click the+
icon under the Query Parameters section - The name of the parameter should be set to
completed
, this parameter should not be required and is of typeBoolean
- Click save, note that the new parameter has been added in the design tab
- Under the
Responses
section, select the+
button to add a new response - Select
404 Not Found
from the drop down menu and clickAdd
- Edit the Description of the new response to
Todo not found
- To view the generated OpenAPI spec source code, click
TODO
in the top left next to the green circle icon, this takes you to the root of your API - Select the
Source
tab - At any time if you would like to view the autogenerated redoc Documentation, click
Live Documentation
in the top right