Maashub - old

Number of APIs: 33

This API is the node for the different stakeholders in a specialized transport branche, focusing on establishing interaction between agencies, carriers and issuers. All documentation regarding this API is stored and updated here.

General

Security

The API will be secured at different levels as described in the sections below.

Network Layer

TLS will be used to provide end-to-end encryption.

Business Layer

Calls to the REST API will be secured using access-tokens (according to the OAuth 2.0 specification). An access token should be specified in the Authorization HTTP header for each request.

Example:

$response = $client->request(&#x27;GET&#x27;, &#x27;/api/v1/<context>&#x27;, [
    'headers' => [
        'Accept'        => 'application/json',
        'Authorization' => 'Bearer ' . $accessToken,
    ],
]);

Endpoints

An endpoint consists of the prefix api followed by the version of the API. After that a context must be provided followed by the action and an identifier (if needed) resulting in the following URL:

/api////()

The following contexts can be provided in a call:

Context
agencyResponsible for booking new rides.
carrierResponsible for transporting customers.
issuerResponsible for providing physical cards to identify customers to the carriers.

Success and error responses

A call has succeeded if an HTTP response code of 200 is returned in the call. Additional information might be present in the body of the response.

If an error has occurred an HTTP response code between 400 - 599 will be returned. The body can contain additional information about the error.

For a list of HTTP Status Codes and descriptions, see https://en.wikipedia.org/wiki/ListofHTTPstatuscodes.

Data formats

The API supports two data formats: application/json (JSON) and application/xml (XML).

With the 'Accept' header the data format can be specified for responses. The 'Content-Type' header specifies the data format when sending information to the API.

If no 'Accept' or 'Content-Type' header is present then 'application/json' will be used by default.

Example for a GET request

No information is sent to the API. The 'Accept' header is only required in this situation.

$response = $client->request(&#x27;GET&#x27;, &#x27;/api/v1/<context>&#x27;, [
    'headers' => [
        'Accept'        => 'application/xml',
        'Authorization' => 'Bearer ' . $accessToken
    ]
]);

Example for a POST request

Information is sent to the API and received in the response. The 'Content-Type' and 'Accept' headers are required.

$response = $client->request(&#x27;POST&#x27;, &#x27;/api/v1/<context>&#x27;, [
    'headers' => [
        'Accept'        => 'application/json',
        'Content-Type'  => 'application/json',
        'Authorization' => 'Bearer ' . $accessToken
    ]
]);

Throttling

Calls to the API are throttled. Currently there is a limit of 300 requests per minute.

Changelog

1.0.0 - 25-01-2019

First stable release of the MaasHub API.

  1. Agency-XML - Create ride POST {{AppUrl}}/api/v1/agency/ride

  2. Carrier-XML - Get all rides GET {{AppUrl}}/api/v1/carrier/ride

  3. Agency-JSON - Get ride by ID GET {{AppUrl}}/api/v1/agency/ride/{{Ride ID}}

  4. Agency-XML - Get ride by ID GET {{AppUrl}}/api/v1/agency/ride/{{Ride ID}}

  5. Agency-JSON - Create ride POST {{AppUrl}}/api/v1/agency/ride

  6. Agency-JSON - Update ride by ID PUT {{AppUrl}}/api/v1/agency/ride/{{Ride ID}}

  7. Agency-JSON - Cancel a ride by ID DELETE {{AppUrl}}/api/v1/agency/ride/{{Ride ID}}

  8. Agency-XML - Get all customers GET {{AppUrl}}/api/v1/agency/customer

  9. Agency-XML - Get customer by ID GET {{AppUrl}}/api/v1/agency/customer/{{Customer ID}}

  10. Agency-XML - Get all rides GET {{AppUrl}}/api/v1/agency/ride