Scenario:
A UK traveler from London, Heathrow to JFK on August 30, 2022, for tourism purposes.
Solution:
Using the v3 trips endpoint reference we can build out the following Request Headers, URL & Body:
Header | Value | Requirement |
Accept-Encoding | gzip, deflate, br | Recommended |
Content-Type | application/vnd.api+json | Required |
x-api-key | *Your API Key* | Required |
Request URL:
Request Body:
Now let’s look at the API response (attached).
We can see a lot more data being returned in this endpoint versus the procedures endpoint (most notably COVID restrictions). However, in our current use case, we are only interested in Visa Requirements.
If we look carefully at the response we can see data.attributes.informationGroups[0] contains a procedure with the type=VISA_REQUIREMENTS. In addition, data.attributes.informationGroups[0].groupings[0].data[0].id will give us the following procedure ID:
5683d46a-9338-41b1-a1f5-897a598e9a57
Since this is the only VISA procedure within the included array, this is the correct procedure to display.
If we want more information about this procedure we can filter the included[] array for this procedure ID. included[0].attributes will give us all the relevant information we need.