Skip to content

Latest commit

 

History

History
523 lines (496 loc) · 11.1 KB

bus_route.md

File metadata and controls

523 lines (496 loc) · 11.1 KB

Bus Route

The Bus Route API Schema contains the bus unit routing information. In this module, it will let you:

Data Structure

Field Type Description
id string The unique bus route ID and the primary key.
bus_id string The unique bus ID and the sort key.
bus_unit_id string The bus unit ID for the identification of specific bus unit route.
currency_code string The medium of exchange for goods and services (Currency Codes List).
rate number The fare charged to the passenger.
active boolean The availability of the bus unit for the defined route.
departure_time string The expected departure time on the starting point and in 24-hour format (e.g. 15:00).
arrival_time string The expected arrival time on the destination and in 24-hour format (e.g. 15:00).
from_route string The starting point of a bus.
to_route string The destination of a bus.
date_created string The date that this bus unit record was created.

API Usage and Specification

Headers

Key Value
Content-Type application/json

Setting to application/json is recommended.

HTTP Response Status Codes

Status Code Description
200 OK
400 Bad Request
500 Internal Server Error

Create Bus Route

To create a new bus route instance, you need to instantiate an object that represents the bus route property. The bus route instance holds the information related to the specific bus unit route.

Method: POST

Endpoint: https://{api_id}.execute-api.{region}.amazonaws.com/prod/bus-route/create

Payload

Field Type Description Required
bus_id string The unique bus ID.
bus_unit_id string The bus unit ID for the identification of specific bus unit route.
currency_code string The medium of exchange for goods and services (Currency Codes List).
rate number The fare charged to the passenger.
active boolean The availability of the bus unit for the defined route.
departure_time string The expected departure time on the starting point and in 24-hour format (e.g. 15:00).
arrival_time string The expected arrival time on the destination and in 24-hour format (e.g. 15:00).
from_route string The starting point of a bus.
to_route string The destination of a bus.

Sample Payload

{
  "rate": 120,
  "active": true,
  "currency_code": "PHP",
  "bus_id": "SNRSBSS-875011",
  "bus_unit_id": "SNRSBSSBUS002",
  "departure_time": "15:00",
  "arrival_time": "17:00",
  "from_route": "Route A",
  "to_route": "Route B"
}

Get Bus Route Information

When retrieving the specific bus route information, the id and bus_id query parameters must be present in the URL. These parameters identify which information should be returned. It will either return a representation of a specific bus route information or a list of bus route information.

Method: GET

Endpoint: https://{api_id}.execute-api.{region}.amazonaws.com/prod/bus-route/get

Specific Bus Route

Query Parameters

Parameter Type Description Required
id string The unique bus route ID.
bus_id string The unique bus ID.

Sample Response

[
  {
    "rate": 120,
    "active": true,
    "currency_code": "PHP",
    "id": "RTRTC15001900877753",
    "bus_id": "SNRSBSS-875011",
    "bus_unit_id": "SNRSBSSBUS002",
    "departure_time": "15:00",
    "arrival_time": "17:00",
    "from_route": "Route A",
    "to_route": "Route B"
  }
]

Filter Bus Route Record

When retrieving a list of bus route records, the bus_id query parameter must be present in the URL, and either of the active, bus_unit_id, departure_time, arrival_time, from_route, or to_route is optional in the query parameter. These parameters will identify which bus route record(s) should be returned.

Method: GET

Endpoint: https://{api_id}.execute-api.{region}.amazonaws.com/prod/bus-route/search?bus_id=xxxxxx

Query Parameters

Parameter Type Description Required
bus_id string The unique bus ID.
bus_unit_id string The bus unit ID for the identification of specific bus unit route.
active boolean The availability of the bus unit for the defined route.
departure_time string The expected departure time on the starting point and in 24-hour format (e.g. 15:00).
arrival_time string The expected arrival time on the destination and in 24-hour format (e.g. 15:00).
from_route string The starting point of a bus.
to_route string The destination of a bus.

Sample Response

[
  {
    "id": "RTBRTC15001900880102",
    "bus_id": "SNRSBSS-875011",
    "bus_unit_id": "SNRSBSSBUS002",
    "currency_code": "PHP",
    "rate": 90,
    "active": true,
    "departure_time": "15:00",
    "arrival_time": "19:00",
    "from_route": "Route B",
    "to_route": "Route C",
    "date_created": "1688010233"
  },
  {
    "id": "RTRTB15001900880101",
    "bus_id": "SNRSBSS-875011",
    "bus_unit_id": "SNRSBSSBUS002",
    "currency_code": "PHP",
    "rate": 90,
    "active": true,
    "departure_time": "15:00",
    "arrival_time": "19:00",
    "from_route": "Route A",
    "to_route": "Route B",
    "date_created": "1688010114"
  }
]

Update Bus Route Record

When modifying the bus route record, the id and bus_id query parameters must be present in the URL. These parameters identify which bus route record should be modified. After the update is performed, it will return a representation of the updated bus route record.

Method: POST

Endpoint: https://{api_id}.execute-api.{region}.amazonaws.com/prod/bus-route/update?id=xxxxx&bus_id=xxxxx

Query Parameters

Parameter Type Description Required
id string The unique bus route ID.
bus_id string The unique bus ID.

Payload

Parameter Type Description Required
currency_code string The medium of exchange for goods and services (Currency Codes List).
rate number The fare charged to the passenger.
active boolean The availability of the bus unit for the defined route.
departure_time string The expected departure time on the starting point and in 24-hour format (e.g. 15:00).
arrival_time string The expected arrival time on the destination and in 24-hour format (e.g. 15:00).
from_route string The starting point of a bus.
to_route string The destination of a bus.

Sample Request

Payload:

{
  "active": false
}

Response:

{
  "id": "RTRTB15001900880101",
  "bus_id": "SNRSBSS-875011",
  "bus_unit_id": "SNRSBSSBUS002",
  "currency_code": "PHP",
  "rate": 90,
  "active": false,
  "departure_time": "15:00",
  "arrival_time": "19:00",
  "from_route": "Route A",
  "to_route": "Route B",
  "date_created": "1688010114"
}