Updating the apiary Flight API

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:

  1. Log in into apiary and switch to the Flight API endpoint.
  2. Change the source of the API Blueprint.

Step 1 – Log in to apiary and switch the API

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:

Step 1 – Log in to apiary and switch the API

Step 2 – Change the source of the API Blueprint

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:

Step 2 – Change the source of the API Blueprint

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:

Step 2 – Change the source of the API Blueprint

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset