Skip to content

Web APIs

Tao Peter Wang edited this page Aug 18, 2016 · 6 revisions

/shutdown

  • Shut down MiddRides server completely
  • Method: POST
  • Parameters (x-www-form-urlencoded):
  • Response:
    • error - String: error if any
    • status - boolean: server running status, false if shutdown success

/turnon

  • Turn MiddRides server on
  • Method: POST
  • Parameters (x-www-form-urlencoded):
    • password: admin password for MiddRides server
  • Response:
    • error - String: error if any
    • status - boolean: server running status, true if turn-on success

/dispatcher

  • Enter dispatcher login page
  • Method: GET
  • Parameters: N/A
  • Response: [HTML]

/pubsafe

  • Enter dispatcher home page, with all the stops and live information
  • Method: GET
  • Parameters:
    • password: admin password for MiddRides server
  • Response: [HTML]

/arrive

  • Tell server to send fcm messages to all users waiting at certain stop
  • Method: POST
  • Parameters (json):
    • stopId: MongoDB formatted objectId for the stop to be notified
  • Response:
    • error - String (optional): error if any

/update

  • Replace old stops in database with new ones
  • Method: POST
  • Parameters (x-www-form-urlencoded):
    • password: admin password for MiddRides server
    • [{ $stopName: $_id }, ...]
  • Response:
    • error - String : error if any
    • inserted - Number: number of stops inserted into database

/getwaiting

  • Get number of people waiting at each stops
  • Method: GET
  • Parameters: N/A (So I decided that this API should be open for any creepy stalker to use)
  • Response:
    • [{ $stopId: $_id, numWaiting: x }, ...]

Clone this wiki locally