Learn more >
Aoun Lutfi | Published February 12, 2018
API ManagementPythonWeb developmentCloud
With the API Connect service, you can easily serve your APIs over a secure developer platform. Traditionally, developers prepare their APIs for a web service then implement or develop another service for serving APIs in a secure way. API Connect allows developers focus on APIs while it does the rest of the work. API connect can:
This guide explains:
This study explains how to:
In order to use this how-to, you need the following prerequisites:
Assuming you have an IBM Cloud account setup, this guide should take around 30 mins to complete.
Let’s start our how-to with preparing example web application. We will use the Python Flask Web Starter boilerplate for that purpose. Open you IBM Cloud catalog and write python in the search bar. Select Python Flask Application. 1. Give it a name and create the application
Wait for the application to start and now you should have a python application up and running. See the application by clicking on Visit App URL or by going to https://<application-name>.mybluemix.net.
Once the application is open, you will see an example landing page like the one seen below:
You can also try some of the other APIs available by default in the boilerplate app. Navigate to:
To create an API Connect service, go to the IBM Cloud catalog and search for API Connect, click the only result. When prompted to create the service, give it a name and go ahead with provisioning the service.
We now need to configure API Connect, let’s add a new API by launching the API Connect tool and selecting the Add button.
Select New API from the drop down menu.
Now fill in the API details, specifically, the Base Path should be /api/people.
Once the new API has been created you should see a bunch of new configuration options on the left side menu bar.
Let’s select the Path option from the menu and add a new entry called /api, with the same name and path.
Also, ensure that the security option is enabled, For this example we will enable the option to use an API key in the header.
Save any changes using the disk icon on the top right.
Now we head over to Assemble menu and click on the Play button.
In the tab that opens on the right, enter the application URL (ex. https://<application-name>.mybluemix.net/api/people), set the method as GET, and choose No Cache for the Cache type.
Ensure the changes are saved. We’ve now completed the minimal amount of configuration necessary for API Connect.
Head back to Drafts section and select Products to setup a new API Connect product, which is a collection of endpoints.
Give the new product a name, such as python-app and click Create product
Once created, head over to the API section in the left hand menu and add an API. Select the API we created in the previous step and select Apply.
Save any changes by clicking the disk icon.
We’ve now created our API Connect product, our last step is to publish our APIs.
Head over to the Dashboard and select Sandbox.
Under Products, find the product you created in the previous step.
Publish the product.
Congratulations!, you have published your first API with API Connect.
You can test your APIs but heading over to Drafts > APIs > Assemble and clicking on the Play button next to the search bar.
Choose the get /api operation, and then click the Invoke button.
This response should be the same as the response as earlier in our how-to.
You can also navigate to the developer portal by going Dashboard > Sandbox > Settings > Portal to view the link to invite collaborators.
With API connect you can connect various web services built in any language (such as Python) to your API Connect platform. With API connect, you can expose APIs, manage and track usage, all while ensuring your product is secure at the same time.
In this how-to, we just simply created one web service and binded it to API Connect. We covered how to:
Back to top