paint-brush
How to Expose Your API Endpoint Using Choreoby@kavishkafernando
240 reads

How to Expose Your API Endpoint Using Choreo

by Kavishka FernandoSeptember 18th, 2021
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Choreo allows you to create, publish and manage all aspects of an API and its’ lifecycle. In this blog post, let’s have a look at how we can create API that has an already existing service.
featured image - How to Expose Your API Endpoint Using Choreo
Kavishka Fernando HackerNoon profile picture


Photo by trail on Unsplash.


Choreo allows you to create, publish and manage all aspects of an API and its’ lifecycle. In this blog post, let’s have a look at how we can create an API that has an already existing service.


Create the API


  1. Sign in to the Choreo Console at https://console.choreo.dev/


  2. Navigate to the APIs card and click on Get Started.


  3. Click Next in the Create an API proxy card on the Create API page.


  4. Select the Design a new REST API card and click Next.


  5. You can provide the following details or provide details relevant to your service,


    API Name: Covid19API API Version: 1.0.0 Endpoint : https://disease.sh


  6. Click on Create, and your API will be created. You will be directed to the Overview of the API.


    There are multiple configurations that you can add to your API. You can add the following details related to your API under each configuration:


    Design Configurations: description, tags

    Business Info: business owner and technical owner details

    Documents: documentation related to the API

    Runtime Configurations: CORS configurations, Application-level security Resources: add GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS resources API Definition: import/download definition, convert to json/yaml

    Endpoint Configuration: endpoint configuration

    Subscriptions: Attach a subscription plan to the API and manage subscriptions.


  7. To add a resource to the API, follow the steps below.


  8. a. Under API Configuration, select Resources.

    b. Select GET from the HTTP Verb dropdown. c. Enter /v3/covid-19/states as the URI pattern and click the + button to add the resource. d. Click Save.


    Deploy the API


    1. Click the Deploy tab in the left navigation pane.


    2. On the Deployments page, click on Create a Revision and Deploy.


    3. Add “This is a Demo revision” as the description and click Deploy.


    You have now successfully created a revision from the current API and deployed it.


    Test the API


    1. Click the Test tab in the left navigation pane.


    2. Click GET TEST KEY to get an access token.


    3. Click on the GET resource that was added previously and click on Try it out, and then Execute.


    We have now successfully created and tested the API. Let’s Publish the API to the Developer Portal so that API consumers can use the API.


    Publish the API


    1. Click the Publish tab in the left navigation pane.


    2. Click Publish on the Lifecycle Management page.


    3. Click Go To Developer Portal to consume the API from the developer portal.


    Invoke the API


    The published API is shown on the Developer portal as below.


    1. Click the Credentials tab in the left navigation pane.


    2. Click Generate Credentials which creates the credentials for an internal application and subscribes to the API using that internal application.


    3. Click on Generate Access Token and copy the access token.


    4. Click the Try Out tab in the left navigation pane.


    5. Paste the copied access token in the Access Token field.


    6. Click on the GET resource you added and click on Try it out, and then Execute.


    You will be able to see the COVID-19 data for all the states of the USA as the response from the API.


    You have now successfully created, tested, and published your API in the developer portal and invoked the API successfully!!