Last updated

Chained Workflows

Some Spotnana APIs rely on a chained workflow where the response from one API call is used as part of the request body in subsequent API calls. For example, the get air itineraries API provides a unique searchId as a result of a successful POST API call. This unique searchId is required as part of the request body in the get flight attributes API that must be called next.

Chained Workflows

Fig: Visual representation of a chained workflow.

Sample Use Case

Consider the following scenario that uses our Air APIs to illustrate a typical chained workflow:

You need to retrieve a selected itinerary and its corresponding information such as the leg details, number of travelers, ticket fare, ticket type, policy information and so on. You could use the get selected itinerary API to retrieve this information. However, that API requires a searchId and itineraryId as mandatory parameters as part of the request body.

To retrieve the unique searchId and itineraryId, you’ll first need to run the get air itineraries API and the get flight attributes API in sequential order. These two APIs will return the searchId and itineraryId along with other relevant information. You can now copy and use these two parameters to run the get selected itinerary API.

Air Workflow

Fig: Chained workflow to run the Get Selected Itinerary API.

Some of Spotnana's other APIs also use similar chained workflows. You can find their relevant documentation under the Workflows heading.