Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrated search(route) and search(stop) pages to REST API Method #127

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/_data/rest_api.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@

"vehicles-for-agency": {
"description": "get active vehicles for an agency"
},
"search-stop": {
"description": "helps to find the stops based on the name/keywords"
},
"search-route": {
"description": "helps to find the routes based on the name/keywords"
}
},

Expand Down
45 changes: 45 additions & 0 deletions src/api/example_responses/search_route_crystal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"code": 200,
"currentTime": 1712466541608,
"data": {
"limitExceeded": false,
"list": [
{
"agencyId": "20",
"color": "7C8076",
"description": "",
"id": "20_97",
"longName": "Crystal Springs",
"nullSafeShortName": "97",
"shortName": "97",
"textColor": "000000",
"type": 3,
"url": "http://www.kitsaptransit.com/service/routed-buses/97-crystal-springs"
}
],
"outOfRange": false,
"references": {
"agencies": [
{
"disclaimer": "",
"email": "[email protected]",
"fareUrl": "http://www.kitsaptransit.com/fares/fares",
"id": "20",
"lang": "en",
"name": "Kitsap Transit",
"phone": "(800) 501-7433",
"privateService": false,
"timezone": "America/Los_Angeles",
"url": "http://www.kitsaptransit.com"
}
],
"routes": [],
"situations": [],
"stopTimes": [],
"stops": [],
"trips": []
}
},
"text": "OK",
"version": 2
}
63 changes: 63 additions & 0 deletions src/api/example_responses/search_stop_crystal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"code": 200,
"currentTime": 1712466666374,
"data": {
"limitExceeded": false,
"list": [
{
"code": "3695",
"direction": "W",
"id": "3_14174",
"lat": 47.220786,
"locationType": 0,
"lon": -122.549174,
"name": "40th St W & Crystal Pl W",
"parent": "",
"routeIds": [
"3_53"
],
"staticRouteIds": [
"3_53"
],
"wheelchairBoarding": "ACCESSIBLE"
}
],
"outOfRange": false,
"references": {
"agencies": [
{
"disclaimer": "",
"email": "",
"fareUrl": "https://www.piercetransit.org/PT-fares/",
"id": "3",
"lang": "en",
"name": "Pierce Transit",
"phone": "1-253-581-8000",
"privateService": false,
"timezone": "America/Los_Angeles",
"url": "https://www.piercetransit.org"
}
],
"routes": [
{
"agencyId": "3",
"color": "6cb33f",
"description": "",
"id": "3_53",
"longName": "University Place",
"nullSafeShortName": "53",
"shortName": "53",
"textColor": "000000",
"type": 3,
"url": "https://www.piercetransit.org/routes/?id=53"
}
],
"situations": [],
"stopTimes": [],
"stops": [],
"trips": []
}
},
"text": "OK",
"version": 2
}
17 changes: 17 additions & 0 deletions src/api/where/methods/search-route.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
layout: rest_api
title: Search-Route Method
description: Search for a route based on its name.
sample_request_url: https://api.pugetsound.onebusaway.org/api/where/search/route.json?input=crystal&key=TEST
example_response_file: search_route_crystal.json
---

## Request Parameters

* `input` - the string to search for, encoded directly in the URL:
* `https://api.pugetsound.onebusaway.org/api/where/search/route.json?input=[INPUT GOES HERE]`
* `maxCount` - the max number of results to return. Defaults to 20.

## Response

The method returns a [list result](/api/where/elements/list-result), so see additional documentation on controlling the number of elements returned and interpreting the results. The list contents are `<route/>` elements, so see details about the various properties of the [`<route/>` element](/api/where/elements/route).
17 changes: 17 additions & 0 deletions src/api/where/methods/search-stop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
layout: rest_api
title: Search-Stop Method
description: Search for a stop based on its name.
sample_request_url: https://api.pugetsound.onebusaway.org/api/where/search/stop.json?input=crystal&key=TEST
example_response_file: search_stop_crystal.json
---

## Request Parameters

* `input` - the string to search for, encoded directly in the URL:
* `https://api.pugetsound.onebusaway.org/api/where/search/stop.json?input=[INPUT GOES HERE]`
* `maxCount` - the max number of results to return. Defaults to 20.

## Response

The method returns a [list result](/api/where/elements/list-result), so see additional documentation on controlling the number of elements returned and interpreting the results. The list contents are `<stop/>` elements, so see details about the various properties of the [`<stop/>` element](/api/where/elements/stop).
6 changes: 3 additions & 3 deletions src/api/where/search/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The Search API follows all the conventions of the RESTful API.

## Methods

The current list of supported Search searches:
The current list of supported searches are:

* [stop](/api/where/search/stop)
* [route](/api/where/search/route)
* [stop](/api/where/methods/search-stop)
* [route](/api/where/methods/search-route)
47 changes: 0 additions & 47 deletions src/api/where/search/route.md

This file was deleted.

51 changes: 0 additions & 51 deletions src/api/where/search/stop.md

This file was deleted.

Loading