The Bus Unit API Schema contains the Bus Company's active bus unit and the unit's capacity. In this module, it will let you:
- Create a new Bus Unit Records
- Get specific Bus Unit Record
- Filter Bus Unit Records
- Update Bus Unit Record
Field | Type | Description |
---|---|---|
bus_id
|
string | The unique bus ID and the sort key. |
code
|
string | The code is a unique identification of a Bus Unit and is the primary key. |
active
|
boolean | Defines if the Bus Unit is on "trip". |
min_capacity
|
number | The minimum number of passenger. |
max_capacity
|
number | The maximum number of passenger. |
date_created
|
string | The date that this bus unit record was created. |
Key | Value |
---|---|
Content-Type
|
application/json
|
Setting to application/json
is recommended.
Status Code | Description |
---|---|
200 | OK |
400 | Bad Request |
500 | Internal Server Error |
To create a new bus unit instance, you must initialize an array of objects representing bus units. It should contain at least one item in the array and each item represents specific bus unit properties.
Method: POST
Endpoint: https://{api_id}.execute-api.{region}.amazonaws.com/prod/bus-unit/create
Field | Type | Description | Required |
---|---|---|---|
code
|
string | The code is a unique identification of a Bus Unit. | ✅ |
bus_id
|
string | The unique bus ID. | ✅ |
active
|
boolean | Defines if the Bus Unit is on "trip". | ✅ |
min_capacity
|
number | The minimum number of passenger. | ✅ |
max_capacity
|
number | The maximum number of passenger. | ✅ |
[
{
"bus_id": "BCBSCMPN-875011",
"code": "BCBSCMPNBUS001",
"active": true,
"min_capacity": 30,
"max_capacity": 60
},
{
"bus_id": "BCBSCMPN-875011",
"code": "BCBSCMPNBUS002",
"active": true,
"min_capacity": 30,
"max_capacity": 60
}
]
When retrieving the specific bus unit record, the code
and bus_id
query parameters must be present in the URL. These parameters identify which bus unit record should be returned. It will either return a representation of a specific bus unit record or a list of bus unit records.
Method: GET
Endpoint: https://{api_id}.execute-api.{region}.amazonaws.com/prod/bus-unit/get
Query Parameters
Parameter | Type | Description | Required |
---|---|---|---|
code
|
string | The code is a unique identification of a Bus Unit. | ✅ |
bus_id
|
string | The unique bus ID. | ✅ |
[
{
"bus_id": "BCBSCMPN-875011",
"code": "BCBSCMPNBUS002",
"active": true,
"min_capacity": 30,
"max_capacity": 60
}
]
When retrieving a list of bus unit records, the bus_id
query parameter must be present in the URL, and either code
or active
is optional in the query parameter. These parameters will identify which bus unit record(s) should be returned.
Method: GET
Endpoint: https://{api_id}.execute-api.{region}.amazonaws.com/prod/bus-unit/search?bus_id=xxxxxx
Parameter | Type | Description | Required |
---|---|---|---|
bus_id
|
string | The unique bus ID. | ✅ |
code
|
string | The code is a unique identification of a Bus Unit. | ❌ |
active
|
boolean | Defines if the Bus Unit is on "trip". | ❌ |
[
{
"bus_id": "BCBSCMPN-875011",
"code": "BCBSCMPNBUS001",
"active": true,
"min_capacity": 30,
"max_capacity": 60,
"date_created": "1687501761"
},
{
"bus_id": "BCBSCMPN-875011",
"code": "BCBSCMPNBUS003",
"active": true,
"min_capacity": 45,
"max_capacity": 70,
"date_created": "1687501761"
},
{
"bus_id": "BCBSCMPN-875011",
"code": "BCBSCMPNBUS002",
"active": true,
"min_capacity": 30,
"max_capacity": 60,
"date_created": "1687501761"
}
]
When modifying the bus unit record, the code
and bus_id
query parameters must be present in the URL. These parameters identify which bus unit record should be modified. After the update is performed, it will return a representation of the updated bus unit record.
Method: POST
Endpoint: https://{api_id}.execute-api.{region}.amazonaws.com/prod/bus-unit/update?code=xxxxx&bus_id=xxxxx
Parameter | Type | Description | Required |
---|---|---|---|
code
|
string | The code is a unique identification of a Bus Unit. | ✅ |
bus_id
|
string | The unique bus ID. | ✅ |
Field | Type | Description | Required |
---|---|---|---|
active
|
boolean | Defines if the Bus Unit is on "trip". | ❌ |
min_capacity
|
number | The minimum number of passenger. | ❌ |
max_capacity
|
number | The maximum number of passenger. | ❌ |
Payload:
{
"active": false
}
Response:
{
"bus_id": "BCBSCMPN-875011",
"code": "BCBSCMPNBUS002",
"active": false,
"min_capacity": 30,
"max_capacity": 60,
"date_created": "1687501761"
}