Creating API Using ColdFusion APIM By Importing From Swagger

swagger

ColdFusion API Manager supports importing an API from Swagger. In the last article we read How To Create Manual API In ColdFusion API Manager. In this article we will see how a swagger doc can be imported to create an API.

What is Swagger?

Swagger is a specification for describing, producing, consuming, and visualizing RESTful web services. On 1 January 2016 Swagger was renamed the OpenAPI Specification

This is a sample swagger doc which is representing a petstore restful web service. It contains description of service, its endpoint, its resources etc etc. Each ‘path’ contains sub-resources and each sub-resource will further have different HTTP verbs like get,post etc.

swagger1

 

You can read more about swagger here

 

Importing API from Swagger

So lets see how can we use these Swagger docs to import APIs into our API manager.

Step 1

In the Create API page, click Import REST API from Swagger.

swagger2

Step 2

Enter the URL of the Swagger doc. In this example, use petstore’s swagger doc.

http://petstore.swagger.io/v2/swagger.json

swagger3

Step 3

After clicking Import , the REST API is generated using this Swagger doc. Details like version, description, and so on are fetched from the Swagger doc.

swagger4

Step 4

In the Resources section, you can view all the resources of the Petstore Swagger doc.

swagger5

Step 5

To publish the API, click Publish.

Step 6

Test the API.

swagger6

So with simple steps we have imported an API from a swagger doc. ColdFusion APIM supports both versions of swagger – swagger 1.2 as well as swagger 2.0

You may also like...

1 Response

  1. April 8, 2016

    […] So we have created our first API manually. In next tutorial we will cover Creating API Using ColdFusion APIM By Importing From Swagger […]

Leave a Reply

Your email address will not be published. Required fields are marked *