How To Create Manual API In ColdFusion API Manager

ColdFusion API Manager helps you to create APIs that expose core functionalities of application and other backend systems. These APIs are then published and managed at runtime. We can create APIs manually, from swagger, from SOAP or import from ColdFusion.

In this article we will create an API manually from scratch. We will build Box Office API. This API will return revenue details of any movie. Server side of this API is already implemented. For example this is the server side call to use this api :

http://fbapps.j.layershift.co.uk/pagehelper/getmovies?year=2016&order=desc&sort=lifetime&type=bollywood

Here ‘http://fbapps.j.layershift.co.uk/pagehelper’ is the endpoint, ‘getmovies‘ is a resource and rest are the parameters it expects.

So let’s convert this functionality into an API using our APIM platform

Step 1 – Login

Login into API manager’s portal with the user having atleast ‘publisher’ role

create coldfusion api 1

Step 2 – Choose creation flow

Once you login, click on ‘Create API’ link on left nav. Now click ‘Create REST API

create coldfusion api 2

Step 3 – API details form

Fill in the basic details of this API. You can keep any API name. Endpoint has to be ‘http://fbapps.j.layershift.co.uk/pagehelper

create coldfusion api box office 3

Step 4 – Add resource

Now move to resources section. Our API has only 1 resource which we will add now. Enter ‘/getmovies‘ , choose ‘get‘ method and click Add resource. The resource has been added. You can expand it by clicking on green arrow

create coldfusion api 4

Step 5 – Add parameters

This API expects 4 parameters. Lets add them. All of them will be of type ‘query

year – Year of release of movies
sort – Whether to sort by lifetime revenue, first day revenue or first weekend revenue
order – Sort in ascending or descending order
type – Bollywood movies or hollywood movies

create coldfusion api box office 5

Step 6 – Publish API

Now our resource is ready. Time to publish the API

create coldfusion api 6

Step 7 – Preview API

Once API is published, you will be shown the preview of the API. You can re-verify the details and if required edit and re-publish the API

create coldfusion api boxoffice 7

Step 8 –  Test API

Now we will test this API. Click on ‘Test this API‘ on left nav. Expand the resource.

create coldfusion api boxoffice 8

Step 9 – Run API call

Fill in the value of parameters. Choose ‘application/json‘ as return type(produces). In this case we have only 1 option as API supports Json format only. And finally run API call. Once API call is complete, you can see the result along with the response and request details

create coldfusion api 9 boxoffice

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

You may also like...

1 Response

  1. April 6, 2016

    […] 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 […]

Leave a Reply

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