Giter Club home page Giter Club logo

pnrapi's Introduction

PNR API

We all hate Indian Railways for being sucky, and not providing a public API to query the PNR status of railway tickets. So, I thought I'd make my own when my favorite 3rd party API was down.

Usage

As simple as it gets! Suppose your PNR is 6223797269. Just do a GET at:

http://pnrapi.dfth.in/pnr/6223797269

And you'll get a JSON like this:

{
  "data": {
    "alight": {
      "code": "NDLS", 
      "name": "NEW DELHI"
    }, 
    "board": {
      "code": "JSME", 
      "name": "JASIDIH"
    }, 
    "chart_prepared": "CHART PREPARED", 
    "class": "SL", 
    "from": {
      "code": "JSME", 
      "name": "JASIDIH"
    }, 
    "passenger": [
      {
        "seat_number": "Can/Mod", 
        "status": "W/L 54,RLGN"
      }
    ], 
    "to": {
      "code": "NDLS", 
      "name": "NEW DELHI"
    }, 
    "train_name": "POORVA EXPRESS", 
    "train_number": "12303", 
    "travel_date": "5-10-2013"
  }, 
  "status": "OK"
}

Nice and easy!

Testing

If you don't have a valid PNR, don't worry. Use this query for all your testing purposes:

http://pnrapi.dfth.in/pnr/0123456789

It returns a dummy response.

Status Codes

OK when everything's alright.

PNR FLUSHED / SERVICE UNAVAILABLE when either the PNR has been flushed/not generated yet, or the Indian Railways servers are having some nasty issues. Not my fault.

ERROR when due to some mysterious reasons, I'm not able to fetch the result. But try again, and I'll try my best.

Issues

Please feel free to file bugs/feature requests. Better still, fork it and get your hands dirty. :)

pnrapi's People

Contributors

sanketsaurav avatar jee1mr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.