# HK-FERRY-ROUTE

<mark style="color:blue;">`GET`</mark> `https://api.kosontechnology.com/hk-ferry.php`

This API script is designed to retrieve information from the Hong Kong Ferry Route info database using provided parameters.

#### Path Parameters

| Name        | Type    | Description                                 |
| ----------- | ------- | ------------------------------------------- |
| district    | String  | To specify the district type                |
| routeNameE  | String  | To specify the desire route name in English |
| serviceMode | String  | To specify the desire service mode          |
| specialType | Integer | To specify the desire fare type             |
| routeSeq    | Integer | To specify the desire route sequence        |
| stopNameE   | String  | To specify the desire stop name in English  |
| download    | -       | To download the json file                   |

{% hint style="info" %}
This API script is designed to retrieve information from the Hong Kong Ferry Route Information database using provided parameters. The script constructs the appropriate URL based on the parameters provided and then fetches data from the API. Please follow the instructions below to use this script effectively.
{% endhint %}

### Usage

1\. Making an HTTP request via a web browser or API Platform etc.[ ](https://www.postman.com/)[Postman](https://www.postman.com/).

2\. The following parameters are accepted:

<table data-header-hidden><thead><tr><th width="170.33333333333331">Name</th><th>Description</th><th>Format</th></tr></thead><tbody><tr><td>district</td><td>To specify the district type</td><td><ul><li>District type. Etc. <strong>KAITO</strong></li></ul></td></tr><tr><td>routeNameE</td><td>To specify the desire route name in English</td><td><p>Route Name. Etc.</p><p><strong>Po Toi Island - Aberdeen</strong></p></td></tr><tr><td>ServiceMode</td><td>To specify the desire service mode</td><td>Ferry service mode. Etc. <strong>T</strong></td></tr><tr><td>specialType</td><td>To specify the desire fare type</td><td>Fare type. Etc. <strong>1</strong></td></tr><tr><td>routeSeq</td><td>To specify the desire route sequence</td><td>Route sequence. Etc. <strong>1</strong></td></tr><tr><td>stopNameE</td><td>To specify the desire stop name in English</td><td>Stop name. Etc. <strong>Po Toi Island</strong></td></tr><tr><td>download</td><td>To download the JSON output</td><td>This parameter does not require the content, <strong>Leave empty</strong> or <strong>Type anything</strong> is acceptable.</td></tr></tbody></table>

3. Depending on the parameters provided, the script will construct a URL to fetch information from the hk-ferry-route database.

### Parameter Guidelines <a href="#d668o0dowp30" id="d668o0dowp30"></a>

* **`district` Parameter**:
  * If you provide a `district` parameter of district type etc. '**KAITO**', the script will retrieve the district type.
* **`routeNameE` Parameter:**
  * If you provide a `routeNameE` parameter of route name etc. '**Po Toi Island - Aberdeen**', the script will retrieve route name.
* **`serviceMode` Parameter:**
  * If you provide a `serviceMode` parameter of service mode type etc. '**T**', the script will all information for selected service mode.
* **`specialType` Parameter:**
  * If you provide a `specialType` parameter of fare type etc. '**1**', the script will retrieve selected route information of the fare type.
* **`routeSeq` Parameter:**
  * If you provide a `routeSeq` parameter of route sequence etc. '**1**', the script will retrieve selected route sequence information.
* **`stopNameE` Parameter:**
  * If you provide a `stopNameE` parameter of stop name etc. '**Po Toi Island**', the script will retrieve information that is matches the selected stop name.
* **download Parameter:**
  * If you want to download the JSON output of these parameters, define the download parameter with empty or any input will enable you to auto download it. See the download sample here.

## List of District

* KAITO
* INNER
* OUTLYING

## List of Route Name and Stop Name

can refer link below to get the detail of the route name and stop name.

{% embed url="<https://www.td.gov.hk/en/transport_in_hong_kong/public_transport/ferries/service_details/index.html>" %}
Inner Harbour and Outlying Island Ferry Services
{% endembed %}

{% embed url="<https://www.td.gov.hk/en/transport_in_hong_kong/public_transport/ferries/kaito_services_map/service_details/index.html>" %}
Kaito Ferry Services
{% endembed %}

## List of Service Mode

* A=whole
* N=night
* NT=night & specific time
* R=regular/day
* T=regular & specific time

## List of Special Type

* 0=Not applicable
* 1=Time or day specific services
* 2=Separate fare for weekend and Public Holidays
* 3=Time or day specific and separate fare for weekend and PHs

## List of Route Sequence

* 1 = outbound or circular route
* 2 = inbound

## Demo

{% embed url="<https://api.kosontechnology.com/hk-ferry.php?district=OUTLYING>" %}
All data about the outlying district
{% endembed %}

{% embed url="<https://api.kosontechnology.com/hk-ferry.php?routeNameE=Central%20-%20Discovery%20Bay>" %}
Data about Central - Discovery Bay route
{% endembed %}

{% embed url="<https://api.kosontechnology.com/hk-ferry.php?stopNameE=Po%20Toi%20Island>" %}
Data of Po Toi Island
{% endembed %}

{% embed url="<https://api.kosontechnology.com/hk-ferry.php?serviceMode=T>" %}
Ferry route information with regular & specific time
{% endembed %}

{% embed url="<https://api.kosontechnology.com/hk-ferry.php?routeSeq=1>" %}
Data for outbound or circular route
{% endembed %}

{% embed url="<https://api.kosontechnology.com/hk-ferry.php?specialType=3>" %}
Route data for Time or day specific and separate fare for weekend and PHs
{% endembed %}

## Download

Add download at the back of the link to download the database in json format.

{% embed url="<https://api.kosontechnology.com/hk-ferry.php?download>" %}
download whole json data
{% endembed %}

{% embed url="<https://api.kosontechnology.com/hk-ferry.php?district=OUTLYING&download>" %}
download all data for outlying district
{% endembed %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://api-gitbook.kosontechnology.com/hk-ferry-route.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
