A Modern Solution to API Development using Talend
APIs (Application Program Interfaces) are a set of protocols, functions or commands used by programmers to develop software programs. What makes APIs important is that they allow the capabilities of one computer program to be used by another. APIs are the means for two different computer programs to communicate. Barriers to change are reduced and makes it easier for people to contribute to the success of an organization. Monetization is another aspect, as it helps in easy integration of the product to third party services.
Talend along with its wide range of services, also provides Cloud API Services. Talend Cloud API Services are easy to create and are user-friendly to open your platform to new business opportunities, all while improving time-to-market and developer productivity. APIs can be built in days and not months and your platform can be extended to new business models and partners.
Use Case Description
I have used an airline traffic use case here to walk you through the API development using Talend.
The aviation industry, more than many, is subject to fluctuations with wide-reaching impacts. Airline traffic data is used by different third-party service providers whom the end customers rely on to get the latest updates on the flight schedules and delays if any. As a result of this, a proper data update and retrieval mechanism is needed to keep the traffic data up to date. Since APIs help in easy integration to third-party services, let us see how to build APIs to update the schedules and retrieve the flight details.
Airline data is stored in Snowflake DB and REST APIs are built to retrieve and update the data available in Snowflake based on the user requirements.
We have used 2 Snowflake tables to store the required airline data.
- AIRLINES table which has the IATA_CODE and the corresponding AIRLINE name.
- FLIGHTS table which has the Flight details.
Talend API Designer, a service available in Talend Cloud, is used to design the APIs based on the user requirements.
An API called Airline Traffic API is created and two operations named postStatus and getStatus are designed in API Designer.
Talend API Tester is a service in Talend Cloud to mock test the APIs designed using the API Designer. The above created API operations are tested using API Tester to check the design requirements of the API.
Once the API has been designed and tested, we must import the API to Talend Studio to design our job based on the requirements.
- Import the API under Rest API Definitions in Metadata.
- Create a job using tRESTRequest and tRESTResponse components along with other components to design the logic.
- A REST Endpoint needs to be defined in the tRESTRequest component. The API can be accessed at this endpoint of the server on which it is hosted.
- Once the job is developed based on the requirements, run the job in the studio.
- The endpoint of the API will be displayed in the run console like below and the API can be accessed at this endpoint.
To access the API and test them, you can use any API testing tool that is available in the market.
- getStatus request
Provide the airlineNumber in the Query Params to get the flight details.
- postStatus request
Provide the airlineNumber and the delay in minutes to update the flight status.
- Once the post request is submitted successfully, the data is updated in the Snowflake table like below.
NB: The above Talend Job can be deployed to Talend Cloud with a Talend Runtime configured to make the API available 24x7.
Talend’s Cloud API Services is a modern approach to designing and developing APIs. In this blog, we discussed how to easily develop an API in the modern-day data ecosystem. Once the API is up and running, you may integrate it to other applications to make the application development easier.
That’s all for now. Keep watching this space for more exciting content.