Railway Trains - India

FREE
By navii
Updated 5 months ago
Travel
8.2/10
Popularity Score
1408ms
Latency
98%
Success Rate

Railway Trains - India API Documentation

Search Indian Railway trains by either train number or it's name.

View API Details
POSTSEARCH
POSTSEARCH

Train Number or Train Name

Header Parameters
X-RapidAPI-HostSTRING
REQUIRED
X-RapidAPI-KeySTRING
REQUIRED
Required Parameters
POSTJSON_STRING
REQUIRED
Code Snippet
unirest.post("https://trains.p.rapidapi.com/")
.header("X-RapidAPI-Host", "trains.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.header("Content-Type", "application/json")
.send({"search":"Rajdhani"})
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
Sample Response
General
Request URL: https://trains.p.rapidapi.com/
Request Method: POST
Response Headers
Response Body

Install SDK for NodeJS

Installing

To utilize unirest for node.js install the the npm module:

$ npm install unirest

After installing the npm package you can now start simplifying requests like so:

var unirest = require('unirest');

Creating Request

unirest.post("https://trains.p.rapidapi.com/")
.header("X-RapidAPI-Host", "trains.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.header("Content-Type", "application/json")
.send({"search":"Rajdhani"})
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
OAuth2 Authentication
Client ID
Client Secret
OAuth2 Authentication