A parking represents a single parking spot owned by a parking company.
GET /companies/:name/parkings
Retrieves all the parking spots of a specific company.
-
Resource URI: /companies/:name/parkings
-
HTTP Req type: GET
-
Res Content Type: application/json
| Parameter |
Type |
Description |
| name |
String |
Name of the company that manages the parking spots |
| HTTP Res Code |
Structure |
Description |
| 200 OK |
|
Returns the list of parkings of the company |
| 404 Not found |
|
The resource cannot be found |
| 401 Unauthorized |
|
Invalid or missing authorization token |
GET /api/companies/Company1/parkings
{
"code": "200",
"status": "success",
"message": "Resource successfully retrieved",
"content": [
{
"location": {
"type": "Point",
"coordinates": [
13.069174,
43.139802
]
},
"plate": null,
"handicap": false,
"indoor": false,
"price": 2,
"company": "Company1",
"isApproved": true,
"isUsable": true,
"_id": "5e2494b12681366ecc4d2c06",
"id": 1,
"address": "Madonna delle Carceri",
"city": "Camerino",
"isFree": true
},
{
"location": {
"type": "Point",
"coordinates": [
13.068363,
43.13937
]
},
"plate": null,
"handicap": false,
"indoor": false,
"price": 2,
"company": "Company1",
"isApproved": true,
"isUsable": true,
"_id": "5e2494b12681366ecc4d2c16",
"id": 2,
"address": "Madonna delle Carceri",
"city": "Camerino",
"isFree": true
}
]
}
GET /companies/:name/parkings/:id
Retrieves a parking spot of a specific company.
-
Resource URI: /companies/:name/parkings/:id
-
HTTP Req type: GET
-
Res Content Type: application/json
| Parameter |
Type |
Description |
| name |
String |
Name of the company that manages the parking spot |
| id |
Int |
Id of the parking spot |
| HTTP Res Code |
Structure |
Description |
| 200 OK |
|
Returns the requested parking spot |
| 404 Not found |
|
The resource cannot be found |
| 401 Unauthorized |
|
Invalid or missing authorization token |
GET /api/companies/Company1/parkings/1
{
"code": "200",
"status": "success",
"message": "Resource successfully retrieved",
"content": {
"location": {
"type": "Point",
"coordinates": [
13.069174,
43.139802
]
},
"plate": null,
"handicap": false,
"indoor": false,
"price": 2,
"company": "Company1",
"isApproved": true,
"isUsable": true,
"_id": "5e2494b12681366ecc4d2c06",
"id": 1,
"address": "Madonna delle Carceri",
"city": "Camerino",
"isFree": true
}
}
POST /companies/:name/parkings
Creates a new parking for the company.
-
Resource URI: /companies/:name/parkings
-
HTTP Req type: POST
-
Req Content Type: application/x-www-form-urlencoded
-
Res Content Type: application/json
| Parameter |
Type |
Description |
| name |
String |
Name of the company that manages the parking spots |
| Parameter |
Type |
Description |
| id |
Int |
Parking ID |
| city |
String |
Parking city |
| address |
String |
Parking address |
| latitude |
String |
Parking latitude |
| longitude |
String |
Parking longitude |
| indoor |
Boolean |
Location of the parking (indoor or outdoor) |
| handicap |
Boolean |
Indicates if the parking is accessible |
| price |
Double |
Hourly rate of the parking |
| HTTP Res Code |
Structure |
Description |
| 201 Created |
|
Resource has been successfully created |
| 422 Unprocessable Entity |
|
The parking spot already exists |
| 401 Unauthorized |
|
Invalid or missing authorization token |
POST /api/companies/Company1/parkings
{
"code": "201",
"status": "success",
"message": "Resource successfully created",
"content": {
"location": {
"type": "Point",
"coordinates": [
13.067321,
43.142813
]
},
"plate": null,
"handicap": false,
"indoor": false,
"price": 1,
"company": "Company1",
"isApproved": false,
"isUsable": true,
"_id": "5e56851a1ddc39111899206c",
"id": 45,
"city": "Camerino",
"address": "Via Madonna delle carceri, 41"
}
}
PATCH /companies/:name/parkings/:id
Updates the properties of a parking spot.
-
Resource URI: /companies/:name/parkings/:id
-
HTTP Req type: PATCH
-
Req Content Type: application/x-www-form-urlencoded
-
Res Content Type: application/json
| Parameter |
Type |
Description |
| name |
String |
Name of the company that manages the parking spot |
| id |
Int |
Id of the parking spot |
| Parameter |
Type |
Description |
| price |
Double |
Hourly rate of the parking |
| isUsable |
Boolean |
Indicates if the parking is currently usable |
| isApproved |
Boolean |
Indicates whether the parking has been approved by the Municipality or not |
| HTTP Res Code |
Structure |
Description |
| 200 OK |
|
Resource has been successfully updated |
| 404 Not found |
|
The resource cannot be found |
| 401 Unauthorized |
|
Invalid or missing authorization token |
PATCH /api/companies/Company1/parkings/45
price=3.0
{
"code": "200",
"status": "success",
"message": "Resource successfully updated",
"content": {
"location": {
"type": "Point",
"coordinates": [
13.067321,
43.142813
]
},
"plate": null,
"handicap": false,
"indoor": false,
"price": 3,
"company": "Company1",
"isApproved": null,
"isUsable": null,
"_id": "5e56851a1ddc39111899206c",
"id": 45,
"city": "Camerino",
"address": "Via Madonna delle carceri, 41"
}
}
DELETE /companies/:name/parkings/:id
Deletes a parking spot.
-
Resource URI: /companies/:name/parkings/:id
-
HTTP Req type: DELETE
-
Res Content Type: application/json
| Parameter |
Type |
Description |
| name |
String |
Name of the company that manages the parking spot |
| id |
Int |
Id of the parking spot |
| HTTP Res Code |
Structure |
Description |
| 204 No Content |
|
Resource has been successfully deleted |
| 404 Not found |
|
The resource cannot be found |
| 401 Unauthorized |
|
Invalid or missing authorization token |