Why Migrate from Btrieve to PostgreSQL and other Relational Databases?
Introduction Many independent software vendors (ISV) and corporate users still rely on applications that use a category of database collective called...
3 min read
Antonio Perez : Oct 9, 2017 12:26:00 PM
Microsoft Azure's API Management is a platform for managing and monitoring APIs. Azure API Management allows developers to extend their public API by adding a layer of business insights, analytics, security and protection without having to write any additional code.
Thriftly provides support for managing APIs using Azure API Management without requiring developers to write any extra code, thanks to built-in Web Application Description Language (WADL) support.
This article outlines how you can publish and manage a Thriftly API using the Azure Management platform by simply pasting the Thriftly service URL into the Azure API Management module.
A WADL file is composed of XML that describes a HTTP-based web service, like a Thriftly Gateway API. All the information required to describe your API, such as a function's parameters and their return types are described in this file. Thriftly allows you to add the “?wadl” parameter to the end of any service address to access the WADL file.
For example, following the Primitives Thriftly API example at https://gateway-tx-1.thriftly.io/ThriftlySamples/Primitives opens the APEye testing interface for an API that manipulates primitives.
If we append the ?wadl parameter to a Thriftly Gateway URL (making it look like this:
https://gateway-tx-1.thriftly.io/ThriftlySamples/Primitives?wadl) and refresh, a WADL file describing the API automatically downloads.
This allows other web services that have WADL support to easily consume your API. Thankfully, Azure API Management allows you to create an API service simply by importing this WADL file. We'll import the Thriftly Primitives API Sample onto Microsoft’s Azure platform, and you can follow the same steps to import your custom Thriftly API.
If you don't already have a Microsoft Azure account, you'll have to sign up for one at Azure's home portal. Otherwise, log into your account. Once you're logged into Azure, create a new API by finding the ‘API Management’ module.
When filling out the API Management Service form, be sure to choose the Location nearest your Thriftly Gateway location. This way there is less network overhead when a request reaches your API through Azure. In this example, we've chosen a central US location, since the Thriftly Sample Gateway API is running through the Texas location.
After submitting the API management service form, make your way to the Publisher Portal so we can import your Thriftly API. Find and follow the ‘Import API’ link on top the Publisher Portal dashboard.
When you import the Thriftly API, you have a few options:
We will simply copy the Thriftly WADL URL for the Primitives API at https://gateway-tx-1.thriftly.io/ThriftlySamples/Primitives?wadl and submit the form.
We're almost ready to start testing the API. But first, we need to add our newly created API to a product on Azure. A product in API management has different business rules that a customer must be subscribed to in order to use your API. By default, Azure creates a starter product with some limitations and an unlimited product.
We need to add our API to one of these products because when we call the API, we will be passing a subscription key used to apply certain business rules. This subscription key acts as a form of authorization to prevent non-subscribers from calling your API.
For example, the starter product states that a subscriber can run up to 5 calls per minute with a maximum of 100 calls per week. Select either the starter or unlimited product and assign your API.
Once you've added your API to your products, go back to the API testing section in the Developer Portal to see the API calls that were imported. The Azure Developer Portal provides code examples in C#, Java, JavaScript, PHP, Python, and Ruby to call your API through Azure. Since you are logged in, the subscription keys will automatically populate in the required Ocp-Apim-Subscription-Key header. You can also see your subscription key under the profile dropdown link under your username.
Click on AddStrings and add a request body. We will send over a simple JSON-RPC body to call the AddString API call that will concatenate two strings together. Add this JSON-RPC body to the request body and send.
{
"jsonrpc": "2.0",
"method": "AddStrings",
"params": {
"first_str": "HELLO ",
"second_str": "WORLD " },
"id": 1
}
With that, we've successfully called a Thriftly API through Azure. Azure’s API Management provides many features to extend your public Thriftly API. It can add throttling, so a single account or user can't consume all available bandwidth or CPU time. You're able to set limits on the number of calls per second. Azure allows you to “rewrite” the interface of your API, which allows you to change the exposed API in order to support the needs of a specific client or even a third party integration.
Result Using Azure and Thriftly
The Thriftly Gateway allows you to easily publish APIs that can be shared to clients all over the world.
Microsoft's Azure API Management provides a suite of features to extend your Thriftly API’s capabilities and use your API to generate new revenue streams. Please visit the Thriftly Developer Forum if you have any additional questions regarding Thriftly or Azure API Management.
Helpful Links:
Azure API Docs
Try Thriftly with Azure's API Management Service now!
Introduction Many independent software vendors (ISV) and corporate users still rely on applications that use a category of database collective called...
COBOL applications are the foundation of numerous essential business functions, especially within the banking, insurance, and government sectors....
Imagine breaking free from the constraints of old, monolithic systems and embracing the agility and innovation of cloud-based solutions.