For this orchestration, we are reusing the Flight API built using apiary in Chapter 2,Integrating Our First Two Applications. In the current state the Flight API only has one resource, providing a list of all airlines and the details of each airline in the list. We are going to add two more resources to get a specific airline based on a flight airline code (two characters).
To update the Flight API in apiary we need to execute these steps:
To allow ICS to retrieve specific airline information we need to change the blueprint of the API. Go to login.apiary.io, and log in with your credentials. If you have only one API on your account you are redirected to the ICS Flights API; otherwise you can click on the name of the current selected API and switch to the ICS Flights API as shown in the following screenshot:
We want to add two new resources that ICS can call to get specific airline information based on the first two letters of the flight identification. For example, Flight KL1606
will result in the Flight Code KL
.
We are going to add the resource /airlines/BA
and the resource /airlines/KL
. The first resource will return the AirlineBAW
object and the second resource will return the AirlineKLM
object defined in our API blueprint as follows:
For our purpose, in the orchestration we also need to edit these objects to include a new social
property. The AirlineBAW
object will get the value Salesforce
and the AirlineKLM
object will get the value Twitter
as shown in the following screenshot:
For convenience the new API blueprint is included in the source files of the book for this chapter. Just copy the content of the file ICSBook-Ch10-Apiary-Flights-API.apib
into the editor of your Flight API in apiary and save it. If you want, you can test the new resources as explained in Chapter 2,Integrating Our First Two Applications.