API Bookings - morenagit/wikiTest GitHub Wiki

Bookings

A booking is a parking reservation made by the driver. A parking spot needs to be booked in order for a stop to be considered valid.

POST /companies/:name/bookings

Description

Creates a new booking for a specific parking spot and.

  • Resource URI: /companies/:name/bookings
  • HTTP Req type: POST
  • Req Content Type: application/x-www-form-urlencoded
  • Res Content Type: application/json

Path parameters

Parameter Type Description
name String Name of the company that manages the parking spots

Request Body

Parameter Type Description
parkingId Int Parking ID
email String Email of the driver
plate String License plate of the driver’s vehicle

Response Body

HTTP Res Code Structure Description
201 Created
  • Content
  • Message
  • Code
Resource has been successfully created
422 Unprocessable Entity
  • Message
  • Code
The parking spot has already been booked
404 Not Found
  • Message
  • Code
The parking spot or the company do not exist

Example

POST /companies/:name/bookings

{
    "code": "201",
    "status": "success",
    "message": "Resource successfully created",
    "content": {
        "_id": "5e568d8f1ddc39111899206e",
        "expireAt": "2020-02-26T15:23:59.039Z",
        "company": "Company1",
        "parkingId": 1,
        "plate": "BB888FF",
        "driverEmail": "[email protected]"
    }
}
⚠️ **GitHub.com Fallback** ⚠️