Hello techies, hope you all are exploring and making. This is something very useful for you and anyone who wants to make an application for Indian Railway Train’s information. After some days, I got a comment on my video about How to fetch data from any website and the comment is shown below.
So if you have the same question, then let me answer: it is not possible to fetch Railway status through the Thingspeak.com website because Thingspeak will create a link according to the URL of the page as well as the data ID which is to be fetched. So if you want to get the data for different trains or different stations, obviously the URL of the page will change and hence we would need to make different APIs for every train and every station. But there will be numerous links if we go about it like this. Relax, we have another option for particularly this problem. And the solution is RailwayAPI.com
Railway API is the solution for your every question regarding Indian Railways. Here you can get ready APIs for:
- PNR Status
- Train Route
- Seat Availability
- Trains Between Stations
- Train Name/Number
- Train Fare Enquiry
- Train Arrivals at Station
- Cancelled Trains
- Rescheduled Trains
- Station Name to Code
- Station Code to Name
- Station Autocomplete Suggest
- Train Autocomplete Suggest
So now with this you can get every bit of information for any of your projects that may use a train status display board or a smart phone app. Now let’s see how to use this service.
Getting Started with Railway API
STEP 1: Creating Your Account
Before using this service, first you need to make an account on this website. You don’t need to fill much info, just provide your name and email ID. Click here to directly go to the sign up form. That’s it.After registration you will get your API key in your email. This key will also work as your login password.
STEP 2: Upgrade your Account (Optional)
Yes!, the limited version of this is free. For more, you need to pay for that. But it is worth paying if you are earning from this.
By default you will be subscribed to Starter Pack, which is absolutely free, in which you will be allowed to use every service but the condition limits you to 100 hits/day. So you can request just 100 links in a day. So if you want more, then upgrade your account.
STEP 3: How to use API for different Purpose
There are many functions available on this website as we have already discussed. So how to use them?
Go to this page. Here you will find the proper syntax for how to request the link for different different purposes. So here I don’t need to explain as the page on the site is quite descriptive. Test the API by requesting the link in your browser.
I have requested one API for a train route in my chrome for the train number 12433, and this is what I got in response:
NOTE: Do not share your API key with anyone as you are allotted a very limited numbers of hits per day.
And you can use this link for your projects in the same manner as we have used the API from Thingspeak.com. Hope you got this and found it interesting. If you have any issues, comment below I’ll definitely try to address them.