Skip to content

ag-ayush/RideBoardAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RideBoard API

Python 3.6 Build Status

A RESTful API for CSH Rideboard application. An API key is required to use the API.

Field Descriptions

Event:

Field Description
id The event's unique id.
name Name of the event
creator Username of the person who created the event
cars JSON Formatted list of cars in the event
start_time Time when the event will start in following python datetime format: '%a, %d %b %Y %H:%M:%S'
end_time Time when the event will end in following python datetime format: '%a, %d %b %Y %H:%M:%S'
open_seats Number of available seats in all the cars in the event

Cars:

Field Description
ride_id The car's unique id.
current_capacity Number of people in the car currently
max_capacity _Maximum number of seats available _
departure_time Time when the person will leave in following python datetime format: '%a, %d %b %Y %H:%M:%S'
return_time Time when the person will return in following python datetime format: '%a, %d %b %Y %H:%M:%S'
name Name of the driver
username CSH username of the driver
driver_comment Comments provided by the driver
riders List of usernames currently signed up in the car

/<api_key>/all : GET

Returns all current events in the following JSON list format:

[
  {
    "address": "address", 
    "cars": [
      {
        "current_capacity": 0, 
        "departure_time": "Thu, 02 Aug 2018 06:13:00 GMT", 
        "driver_comment": "", 
        "id": 80, 
        "max_capacity": 0, 
        "name": "Need a Ride", 
        "return_time": "Thu, 09 Aug 2018 06:13:00 GMT", 
        "ride_id": 43, 
        "riders": ["agoel", "red"], 
        "username": ""
      }
    ], 
    "creator": "creator", 
    "end_time": "Thu, 09 Aug 2018 06:13:00 GMT", 
    "id": 43, 
    "name": "Event Name", 
    "open_seats": 2, 
    "start_time": "Thu, 02 Aug 2018 06:13:00 GMT"
  }
]

Allowed Parameters: id

Example request: /all?id=41

/<api_key>/get/car : GET

Returns all current cars in the following JSON list format:

[
  {
    "current_capacity": 0, 
    "departure_time": "Thu, 02 Aug 2018 06:13:00 GMT", 
    "driver_comment": "", 
    "id": 80, 
    "max_capacity": 0, 
    "name": "Need a Ride", 
    "return_time": "Thu, 09 Aug 2018 06:13:00 GMT", 
    "ride_id": 43, 
    "riders": ["agoel", "red"], 
    "username": ""
  }
]

Allowed Parameters: id

Example request: /get/car?id=80

/<api_key>/upcoming : GET

Returns the event with the earliest start date in the following format:

{
  "address": "Addresss", 
  "cars": [
    {
      "current_capacity": 0, 
      "departure_time": "Tue, 31 Jul 2018 08:06:00 GMT", 
      "driver_comment": "", 
      "id": 84, 
      "max_capacity": 0, 
      "name": "Need a Ride", 
      "return_time": "Thu, 09 Aug 2018 08:06:00 GMT", 
      "ride_id": 46, 
      "riders": ["agoel", "red"], 
      "username": ""
    }
  ], 
  "creator": "agoel", 
  "end_time": "Thu, 09 Aug 2018 08:06:00 GMT", 
  "id": 46, 
  "name": "Event 3", 
  "open_seats": 0, 
  "start_time": "Tue, 31 Jul 2018 08:06:00 GMT"
}

/<api_key>/join/<car_id>/<username>/<first_name>/<last_name> : PUT

User joins a provided car and the event in relation to the car is returned as JSON. <username> should always be pulled from the CSH email address.

Required Parameters: car_id,username,first_name,last_name

/<api_key>/leave/<event_id>/<username> : PUT

User leaves the car and the event in relation to the car is returned as JSON. <username> should always be pulled from the CSH email address. Also note, event_id is required, not car_id.

Required Parameters: event_id, username

/<api_key>/create/event : POST

Creates an event, returns the resulting event as JSON. creator should always be pulled from the CSH email address. Also, driver_comment is optional.

Required Parameters: JSON Object

{
  "name": "Testing 12",
  "address":"NEW ADDRESS",
  "start_time":"Thu, 09 Aug 2018 06:13:00",
  "end_time":"Fri, 10 Aug 2018 06:13:00",
  "creator":"agoel",
  "driver_comment": "None."
 }

/<api_key>/create/car/<event_id> : POST

Creates a car in the provided event_id and returns the resulting event as JSON. username should always be pulled from the CSH email address.

Required Parameters: JSON Object

{
    "name": "First Last",
    "username":"user",
    "departure_time":"Thu, 02 Aug 2018 06:13:00",
    "return_time":"Thu, 09 Aug 2018 06:13:00",
    "max_capacity":2,
}

/<api_key>/delete/event/<event_id>/<uid> : DELETE

Deletes the provided event. Returns proper status code, 200 on success. <uid> should always be pulled from the CSH email address.

Required Parameters: event_id, uid

/<api_key>/delete/car/<event_id>/<uid>' : DELETE

Deletes the car that is owned by the user in the provided event. Returns proper status code, 200 on success. <uid> should always be pulled from the CSH email address. Also note, event_id is required, not car_id.

Required Parameters: event_id, uid

/generatekey/<reason> : GET

Generates an unique key, each of which has an unique owner/reason pair. This action can only be done by an RTP or myself.

Required Parameter: reason

Sample Output: 96a2cea9c44c4f699947a3e8e186f036

/listapikeys : GET

Lists all the keys in the database for RTP's and selected users as a JSON list.

Sample Output:

[
  {
    "hash": "96a2cea9c44c4f699947a3e8e186f036", 
    "id": 54, 
    "owner": "agoel", 
    "reason": "For local testing."
  }, 
  {
    "hash": "069db6062ae999d0806baaa9df40d1dd", 
    "id": 55, 
    "owner": "agoel", 
    "reason": "I am testing key sets."
  }
]

About

A RESTful API for interacting with CSH Rideboard

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages