# Introduction to OpenAPI with Apicurio

# Video

# Katacoda Scenario

Try this out on Katacoda (opens new window)

# Lab Instructions

In this lab we will look at managing an OpenAPI spec using Apicurio.

  1. Open a web browser and navigate to https://www.apicur.io/
  2. Select the Try Live button
  3. Login using preferred method
  4. Select APIs on the left and select Create New API in the sub menu Create New
  5. Enter a name and description for the new API
  6. Select Blank API for the template and click Create API
  7. This will take you to the landing page for your new API, at this point we are going to click Edit API
  8. Update the Contact and License info in the Design tab
  9. Add a default Tag Definition of todo
  10. Select the add a server option under the Servers section. Set the Server URL to be localhost:8080
  11. The completed design tab should look similar to this: Config
  12. Click on the + button next to Data Types to add a new data type to the API
  13. Enter Todo for the Name, and for the JSON example paste the following:
        {
            "name": "Todo item",
            "description": "Description of item",
            "date": "2018-05-06T18:25:43.511Z",
            "completed": true
        }
    
  14. Under the Choose to create a REST Resource section, select the REST Resource option and click Save

    TIP

    Two paths have been automatically generated for the new Todo data type

    Paths
  15. Select the Todo data type
  16. Under Properties in the Design tab, select the + button
  17. Add a new property for an id by typing id in the Name field
  18. Under the Enter Type Information section, set the Property to be Not Required and of type String, click save
  19. Select the Source tab to view the yaml source of the Todo type, note the added id property Source
  20. Under the /todos path, select the GET operation, click the + icon under the Query Parameters section
  21. The name of the parameter should be set to completed, this parameter should not be required and is of type Boolean
  22. Click save, note that the new parameter has been added in the design tab completed
  23. Under the Responses section, select the + button to add a new response
  24. Select 404 Not Found from the drop down menu and click Add Not Found
  25. Edit the Description of the new response to Todo not found
  26. 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 Todo
  27. Select the Source tab
  28. At any time if you would like to view the autogenerated redoc Documentation, click Live Documentation in the top right Documentation
Last Updated: 12/18/2021, 5:53:27 PM