Live Train Status.
Number of APIs: 4
Live Train Status is a Qodex Collection which can be used to check the PNR status of the train ticket and can also be used to track the live running status of a train. Complete status is send as an alert to slack using Slack's Incoming Webhook. It can be run locally with the Qodex collection runner, but it's best to run the collection using the slash command in slack. Specifying the PNR no along with slash command can be used to run the complete collection and getting the required output on the slack.
QUICKSTART
Before running the Live Train Status Qodex collection, it requires to create or update an environment. Add the following variables to a new environment, or update the values of these variables by choosing the 'train' environment.
Environment Variable name: |
---|
trainapikey = An API key which can be generated. |
pnrno[Optional] = Specifies the PNR no of the journey. Passing PNR no through slash command do not require to set it as an environment variable. |
incoming_webhook = Specifies the slack's Incoming Webhook URL which is used to send final response to slack. This can be set up from Slack's Incoming Webhook. |
Setting Up Slash Command
Slash Command is basically a way to pass inputs to a Qodex collection. To set up a Slash Command requires a URL of the Qodex collection.
URL of the Qodex collection can be generated from the response of this POST request:
https://api.getQodex.com/webhooks?apikey={{Qodex_api_key}}
Body of this request:
{After the Slash command has been set up. Collection can be executed by passing the 10-digit PNR number along with the slash command and it start executing the requests.webhook: {name:Live Train Status.,collection:{{collection_uid}},environment:{{environment_uid}}} }
API's Used
Indian Rail API, Slack API and Qodex
-
PNR Check GET http://indianrailapi.com/api/v2/PNRCheck/apikey/{{trainapikey}}/PNRNumber/{{pnrno}}/Route/1/
-
Live Running Status of the Train GET https://indianrailapi.com/api/v2/livetrainstatus/apikey/{{trainapikey}}/trainnumber/{{train_no}}/date/{{date_of_journey}}/
-
Sending response to Slack POST {{slack_url}}
-
PNR validation POST {{incoming_webhook}}