The Bus API Schema contains the bus information. In this module, it will let you:
Field | Type | Description |
---|---|---|
id
|
string | The unique bus ID and the sort key. |
name
|
string | The name of the bus line and is the primary key. |
owner
|
string | The name of the bus company owner. |
email
|
string | The bus company e-mail address. |
address
|
string | The bus company address. |
company
|
string | The name of the bus company and is the sort key. |
mobile_number
|
string | The bus company phone number. |
date_created
|
string | The date that this bus information 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 instance, you must initialize an array of objects representing buses. It should contain at least one item in the array and each item represents specific bus properties.
Method: POST
Endpoint: https://{api_id}.execute-api.{region}.amazonaws.com/prod/bus/create
Field | Type | Description | Required |
---|---|---|---|
name
|
string | The name of the bus line. | ✅ |
owner
|
string | The name of the bus company owner. | ✅ |
email
|
string | The bus company e-mail address. | ✅ |
address
|
string | The bus company address. | ✅ |
company
|
string | The name of the bus company. | ✅ |
mobile_number
|
string | The bus company phone number. | ✅ |
[
{
"name": "Blue Horizon",
"owner": "John Doe",
"email": "john.doe@example.com",
"address": "123 Main Street, City",
"company": "ABC Bus Company",
"mobile_number": "123-456-7890"
},
{
"name": "Green Wave",
"owner": "Jane Smith",
"email": "jane.smith@example.com",
"address": "456 Elm Avenue, Town",
"company": "XYZ Bus Services",
"mobile_number": "987-654-3210"
}
]
When retrieving the specific bus information, the id
and name
query parameters must be present in the URL. These parameters identify which bus information should be returned. It will either return a representation of a specific bus information or a list of bus information.
Method: GET
Endpoint: https://{api_id}.execute-api.{region}.amazonaws.com/prod/bus/get
Query Parameters
Parameter | Type | Description | Required |
---|---|---|---|
id
|
string | The unique bus ID. | ✅ |
name
|
string | The name of the bus line. | ✅ |
[
{
"id": "BCBSCMPN-875011",
"name": "Blue Horizon",
"owner": "John Doe",
"email": "john.doe@example.com",
"address": "123 Main Street, City",
"company": "ABC Bus Company",
"mobile_number": "123-456-7890"
}
]
When retrieving a list of bus records, either name
or company
query parameter must be present in the URL. This parameter will identify which bus records should be returned.
Method: GET
Endpoint: https://{api_id}.execute-api.{region}.amazonaws.com/prod/bus/search?name=xxxxxx&company=xxxxxx
Parameter | Type | Description | Required |
---|---|---|---|
name
|
string | The name of the bus line. | ❌ |
company
|
string | The name of the bus company. | ❌ |
[
{
"id": "TRNSTBSC-875011",
"name": "Yellow Sunshine",
"owner": "Melissa Anderson",
"email": "melissa.anderson@example.com",
"address": "741 Oak Avenue, Suburb",
"company": "Transit Bus Co",
"mobile_number": "999-333-7777",
"date_created": "1687501112"
},
{
"id": "BCBSCMPN-875011",
"name": "Blue Horizon",
"owner": "John Doe",
"email": "john.doe@example.com",
"address": "123 Main Street, City",
"company": "ABC Bus Company",
"mobile_number": "123-456-7890",
"date_created": "1687501112"
}
]
When modifiying the bus record, the id
and name
query parameters must be present in the URL. These parameters identify which bus record should be modified. After the update is performed, it will return a representation of the updated bus record.
Method: POST
Endpoint: https://{api_id}.execute-api.{region}.amazonaws.com/prod/bus/update?id=xxxxx&name=xxxxx
Parameter | Type | Description | Required |
---|---|---|---|
id
|
string | The unique bus ID. | ✅ |
name
|
string | The name of the bus line. | ✅ |
Field | Type | Description | Required |
---|---|---|---|
owner
|
string | The name of the bus company owner. | ❌ |
email
|
string | The bus company e-mail address. | ❌ |
address
|
string | The bus company address. | ❌ |
mobile_number
|
string | The bus company phone number. | ❌ |
Payload:
{
"owner": "Daniel Martinez",
"email": "daniel.martinez@example.com"
}
Response:
{
"id": "BCBSCMPN-875011",
"name": "Blue Horizon",
"owner": "Daniel Martinez",
"email": "daniel.martinez@example.com",
"address": "123 Main Street, City",
"company": "ABC Bus Company",
"mobile_number": "123-456-7890",
"date_created": "1687501112"
}