SHANGHAI METRO API

Shanghai Metro API Data Retrieval Script Documentation (上海地铁线API)

This API script is designed to retrieve information from the airport info database using provided parameters. The script constructs the appropriate URL based on the parameters provided and then fetches data from the API. Please follow the instructions below to use this script effectively

Usage

  1. Making a HTTP request via a web browser or API Platform etc. Postman.

  2. The following parameters are accepted:

NameDescriptionFormat

departure_id

To specific desired departure station id

• Station ID. Etc. 0926

destination_id

To specific desired destination station id

• Station ID. Etc. 0737

ticket

To specific desired ticket type

• ‘0’ for metro-card

• ‘1’ for one-way ticket

day

To specific desired day

•‘MONTOTHUR_0’ for Monday to Thursday

•‘FRIDAY_0’ for Friday

•‘SATURDAY_0’ for Saturday

•‘WEEKEND_0’ for Sunday

time

To specific desired time to enter or leave metro in second

• Time to enter or leave metro in second. Etc. 22:44 = ((22*60) +44) *60)

= 82740

line

To specific desired line number

• Line number. Etc. 1

stat_id

To specific desired station id

• Station ID. Etc. 0926

stat_name

To specific desired station name

• Station Name. Etc. JiuTing

download

To download the JSON output

• This parameter does not require the content, Leave empty or Type anything is acceptable

  1. Depending on the parameters provided, the script will construct a URL to fetch information from Shanghai-Metro API

Parameter Guidelines

  • departure_id Parameter:

    • If you provide a valid departure_id parameter of departure station etc. '0926', the script will retrieve information of selected departure station id.

  • destination_id Parameter:

    • If you provide a valid destination_id parameter of destination station etc. '0737', the script will retrieve information of selected destination station id.

  • ticket Parameter:

    • If you provide a valid ticket parameter as '0' or '1', the script will retrieve information of selected ticket.

  • day Parameter:

    • If you provide a valid day parameter as 'MONTOTHUR_0', 'FRIDAY_0', 'SATURDAY_0' or 'WEEKEND_0’, the script will retrieve information of selected day.

  • time Parameter:

    • If you provide a valid timeparameter of entering or arriving metro etc. '82740', the script will retrieve information of selected time.

  • line Parameter:

    • If you provide a lineparameter of metro line etc. '1', the script will retrieve information of selected line.

  • stat_id Parameter:

    • If you provide a stat_idparameter of station etc. '0926', the script will retrieve information of selected station id.

  • stat_name Parameter:

    • If you provide a valid stat_name parameter of station etc. 'JiuTing', the script will retrieve information of selected station name.

  • download Parameter:

    • If you want to download the JSON output of these parameters, define the download parameter with empty or any input will able you to auto download it.

Station ID

Refer this https://api.kosontechnology.com/json/station-ID.json to find your station ID.

Below is a sample how you will see station ID at 'key' value:

  1. Find station name and you will see station ID at top column.

API

  1. Retrieve all metro line number information: All Line Number

  2. Retrieve all metro line timetable: All Line Timetable

  3. Retrieve last line timetable: Last Line Timetable

  4. Retrieve history based on metro line: Line History

  5. Retrieve metro line colour: Line Colour

  6. Retrieve all metro station information: All Station Information

  7. Retrieve metro station based on metro line: Search Station With Line

  8. Retrieve metro station based on station id: Search Station With Station ID

  9. Retrieve metro station information based on station name: Search Station With Station Name

  10. Retrieve last station timetable: Last Station Timetable

  11. Estimate arrival time: Estimate Arrival Time

  12. Check ticket price: Check Price

  13. Check route: Check Route

Last updated