In the previous part of the tutorial, we saw how we can develop a simple API using AWS Lambda following the use case of Google’s AutoML. In this part, we will explore how we can deploy our API to a public marketplace, namely, RapidAPI.
Being able to quickly prototype and create new products is essential. However, this is difficult especially as teams scale. Externalizing your APIs is a good way to efficiently manage your API while also enabling cross-sharing across teams. Even if your team size is small, and your API is already available publicly, a market place enables you to showcase your abilities to a wider audience without the hassle of setting up everything from the scratch.
With this in mind, I started exploring different marketplaces recently to pick a good fit for my use case, i.e, it should be easy to setup and have no unnecessary engineering overhead. While there were several solutions available, like, Google’s Cloud Platform Market Place, Azure’s market place, etc, the best fit for my case was RapidAPI.
The setup in RapidAPI is quick and easy to follow and you can immediately go live with your APIs. It is also very efficient way to manage your APIs, maybe even from different channels, under one central hub. If external APIs are not centralized, there is also no clear way to analyze data and usage. This can be compounded if developers deploy APIs ad hoc, or use a large number of APIs. Without a central hub, an application may have 10 separate API developer dashboards you would need to visit to monitor API usage. RapidAPI simplifies this by giving you a central place to monitor all of that.
Even though developer teams work on different projects, they will likely build similar functionality and would benefit from using the same APIs. For example, a web team and an Android team might both need a way to display a user’s credit score. If developers on the web team are unaware of what APIs have already been used by the Android team or other teams within their organization, they may utilize a different API. This duplication can cause complications since different APIs might return slightly different results. Sticking with the previous example, it would be confusing for a user if the website and the app both reported different credit scores as a result of using different APIs.
With all this in mind, let’s take a look at the steps required to setup your very own public API.
Setting up your API
Continuing with the previous example, here are the steps to deploy your own API to the marketplace:
- Login to RapidAPI and head over to My APIs section above.
- Click on Add New API from the left panel.
- Add the mandatory fields and choose appropriate category. For our case, it will Machine Learning. You can also upload OpenAPI (Swagger) specs directly if you have one.
- Head over to Settings and add the base url, which in our case, will be “https://abc123XY.execute-api.us-east-2.amazonaws.com”
6. Choose an authentication method for access control. By default, it is set to
Use RapidAPI authentication . Also flip the
API Visiblity switch at the bottom to make the API public in the marketplace. We’re not done yet since we still need to add the endpoints.
7. Head over to endpoints and click on
8. Add a new endpoint with relative path to the base URL
Notice that our relative path will be
9. In step 3 of the form, add a JSON model with sample body describing the request:
10. Test the endpoint at the bottom to verify the endpoint and tick “ Display sample response on marketplace”.
Save these changes and that’s it! Your API should be live now in the market place. You can search the API in the marketplace with the name defined in Step 3 above. On clicking the search result, you’ll see a screen similar to this:
Here you can try out the endpoint with a sample request when signed in. There is also a dashboard present to track your requests, error rates, latency, etc. To access this, go to My APIs > API Name > Analytics.
You are ready to integrate this API in your project. Feel free to use the API across projects internally if you’re planning to keep this private or share it publicly with others in the Marketplace. And if you haven’t yet gotten your fill, check out the APIs hosted by us over at Bewgle.