From a17af0a42dc17719bebd836b8335c205b695437a Mon Sep 17 00:00:00 2001 From: Ajaykumar Yadav Date: Sun, 7 Apr 2024 06:01:21 +0000 Subject: [PATCH 1/3] migrated search(route) and search(stop) to REST API Method --- src/_data/rest_api.json | 6 ++ .../search_route_crystal.json | 45 +++++++++++++ .../search_stop_crystal.json | 63 +++++++++++++++++++ src/api/where/methods/search (route).md | 13 ++++ src/api/where/methods/search (stop).md | 13 ++++ src/api/where/search/index.md | 4 +- src/api/where/search/route.md | 47 -------------- src/api/where/search/stop.md | 51 --------------- 8 files changed, 142 insertions(+), 100 deletions(-) create mode 100644 src/api/example_responses/search_route_crystal.json create mode 100644 src/api/example_responses/search_stop_crystal.json create mode 100644 src/api/where/methods/search (route).md create mode 100644 src/api/where/methods/search (stop).md delete mode 100644 src/api/where/search/route.md delete mode 100644 src/api/where/search/stop.md diff --git a/src/_data/rest_api.json b/src/_data/rest_api.json index 872c0eb..077af2c 100644 --- a/src/_data/rest_api.json +++ b/src/_data/rest_api.json @@ -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" } }, diff --git a/src/api/example_responses/search_route_crystal.json b/src/api/example_responses/search_route_crystal.json new file mode 100644 index 0000000..41befde --- /dev/null +++ b/src/api/example_responses/search_route_crystal.json @@ -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": "kitsapride@kitsaptransit.com", + "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 + } \ No newline at end of file diff --git a/src/api/example_responses/search_stop_crystal.json b/src/api/example_responses/search_stop_crystal.json new file mode 100644 index 0000000..e9871a0 --- /dev/null +++ b/src/api/example_responses/search_stop_crystal.json @@ -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 + } \ No newline at end of file diff --git a/src/api/where/methods/search (route).md b/src/api/where/methods/search (route).md new file mode 100644 index 0000000..d60aedb --- /dev/null +++ b/src/api/where/methods/search (route).md @@ -0,0 +1,13 @@ +--- +layout: rest_api +title: search (route) Method +description: Search for a route based on its name. +sample_request_url: http://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: + * `http://api.pugetsound.onebusaway.org/api/where/search/route.json?input=[INPUT GOES HERE]` +* `maxCount` - the max number of results to return. Defaults to 20. diff --git a/src/api/where/methods/search (stop).md b/src/api/where/methods/search (stop).md new file mode 100644 index 0000000..e69f661 --- /dev/null +++ b/src/api/where/methods/search (stop).md @@ -0,0 +1,13 @@ +--- +layout: rest_api +title: search (stop) Method +description: Search for a stop based on its name. +sample_request_url: http://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: + * `http://api.pugetsound.onebusaway.org/api/where/search/stop.json?input=[INPUT GOES HERE]` +* `maxCount` - the max number of results to return. Defaults to 20. diff --git a/src/api/where/search/index.md b/src/api/where/search/index.md index a289e90..9da3ced 100644 --- a/src/api/where/search/index.md +++ b/src/api/where/search/index.md @@ -17,5 +17,5 @@ The Search API follows all the conventions of the RESTful API. The current list of supported Search searches: -* [stop](/api/where/search/stop) -* [route](/api/where/search/route) \ No newline at end of file +* [stop](/api/where/methods/search (stop)) +* [route](/api/where/methods/search (route)) \ No newline at end of file diff --git a/src/api/where/search/route.md b/src/api/where/search/route.md deleted file mode 100644 index cc25224..0000000 --- a/src/api/where/search/route.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -layout: page -title: Route Search API ---- - -Search for a route based on its name. - -## Sample Request - -[http://api.pugetsound.onebusaway.org/api/where/search/route.json?input=crystal&key=TEST](http://api.pugetsound.onebusaway.org/api/where/search/route.json?input=crystal&key=TEST) - -## Sample Response - -

-{
-    "code": 200,
-    "currentTime": 1674233501267,
-    "data": {
-        "limitExceeded": false,
-        "list": [
-            {
-                "agencyId": "1",
-                "color": "727d84",
-                "description": "",
-                "id": "1_DC1",
-                "longName": "CRYSTAL CITY-L'ENFANT PL SHUTTLE",
-                "shortName": "DC1",
-                "textColor": "000000",
-                "type": 3,
-                "url": ""
-            }
-        ],
-        "outOfRange": false,
-        "references": {
-            ...
-        }
-    },
-    "text": "OK",
-    "version": 2
-}
-
- -## Request Parameters - -* `input` - the string to search for, encoded directly in the URL: - * `http://api.pugetsound.onebusaway.org/api/where/search/route.json?input=[INPUT GOES HERE]` -* `maxCount` - the max number of results to return. Defaults to 20. \ No newline at end of file diff --git a/src/api/where/search/stop.md b/src/api/where/search/stop.md deleted file mode 100644 index 3fc0e97..0000000 --- a/src/api/where/search/stop.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -layout: page -title: Stop Search API ---- - -Search for a stop based on its name. - -## Sample Request - -[http://api.pugetsound.onebusaway.org/api/where/search/stop.json?input=crystal&key=TEST](http://api.pugetsound.onebusaway.org/api/where/search/stop.json?input=crystal&key=TEST) - -## Sample Response - -

-{
-"code": 200,
-"currentTime": 1674233149269,
-"data": {
-    "limitExceeded": false,
-    "list": [
-        {
-            "code": "2001084",
-            "direction": "SE",
-            "id": "1_12968",
-            "lat": 39.147039,
-            "locationType": 0,
-            "lon": -77.009724,
-            "name": "NEW HAMPSHIRE AVE + CRYSTAL SPRING DR",
-            "parent": "",
-            "routeIds": [
-                "1_Z2"
-            ],
-            "wheelchairBoarding": "UNKNOWN"
-        }
-        ...
-    ],
-    "outOfRange": false,
-    "references": {
-        ...
-    }
-},
-"text": "OK",
-"version": 2
-}
-
- -## Request Parameters - -* `input` - the string to search for, encoded directly in the URL: - * `http://api.pugetsound.onebusaway.org/api/where/search/stop.json?input=[INPUT GOES HERE]` -* `maxCount` - the max number of results to return. Defaults to 20. \ No newline at end of file From c15f27c2a8659f7f69ae382cfc2ed8f7b89a5511 Mon Sep 17 00:00:00 2001 From: Ajaykumar Yadav Date: Mon, 8 Apr 2024 07:59:59 +0000 Subject: [PATCH 2/3] Added the response of search/stop and search/route --- src/api/where/methods/search (route).md | 2 ++ src/api/where/methods/search (stop).md | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/api/where/methods/search (route).md b/src/api/where/methods/search (route).md index d60aedb..a7104c2 100644 --- a/src/api/where/methods/search (route).md +++ b/src/api/where/methods/search (route).md @@ -11,3 +11,5 @@ example_response_file: search_route_crystal.json * `input` - the string to search for, encoded directly in the URL: * `http://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](../elements/list-result), so see additional documentation on controlling the number of elements returned and interpreting the results. The list contents are `` elements, so see details about the various properties of the [`` element](../elements/route). \ No newline at end of file diff --git a/src/api/where/methods/search (stop).md b/src/api/where/methods/search (stop).md index e69f661..7be0a1c 100644 --- a/src/api/where/methods/search (stop).md +++ b/src/api/where/methods/search (stop).md @@ -11,3 +11,6 @@ example_response_file: search_stop_crystal.json * `input` - the string to search for, encoded directly in the URL: * `http://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](../elements/list-result), so see additional documentation on controlling the number of elements returned and interpreting the results. The list contents are `` elements, so see details about the various properties of the [`` element](../elements/stop). From 73858c681cef4167b71d80cbe4e8cd56f4efbb54 Mon Sep 17 00:00:00 2001 From: Ajaykumar Yadav Date: Fri, 12 Apr 2024 17:56:50 +0000 Subject: [PATCH 3/3] made the changes according to review --- src/_data/rest_api.json | 4 ++-- src/api/where/methods/search (route).md | 15 --------------- src/api/where/methods/search (stop).md | 16 ---------------- src/api/where/methods/search-route.md | 17 +++++++++++++++++ src/api/where/methods/search-stop.md | 17 +++++++++++++++++ src/api/where/search/index.md | 6 +++--- 6 files changed, 39 insertions(+), 36 deletions(-) delete mode 100644 src/api/where/methods/search (route).md delete mode 100644 src/api/where/methods/search (stop).md create mode 100644 src/api/where/methods/search-route.md create mode 100644 src/api/where/methods/search-stop.md diff --git a/src/_data/rest_api.json b/src/_data/rest_api.json index 077af2c..631b998 100644 --- a/src/_data/rest_api.json +++ b/src/_data/rest_api.json @@ -103,10 +103,10 @@ "vehicles-for-agency": { "description": "get active vehicles for an agency" }, - "search (stop)": { + "search-stop": { "description": "helps to find the stops based on the name/keywords" }, - "search (route)": { + "search-route": { "description": "helps to find the routes based on the name/keywords" } }, diff --git a/src/api/where/methods/search (route).md b/src/api/where/methods/search (route).md deleted file mode 100644 index a7104c2..0000000 --- a/src/api/where/methods/search (route).md +++ /dev/null @@ -1,15 +0,0 @@ ---- -layout: rest_api -title: search (route) Method -description: Search for a route based on its name. -sample_request_url: http://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: - * `http://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](../elements/list-result), so see additional documentation on controlling the number of elements returned and interpreting the results. The list contents are `` elements, so see details about the various properties of the [`` element](../elements/route). \ No newline at end of file diff --git a/src/api/where/methods/search (stop).md b/src/api/where/methods/search (stop).md deleted file mode 100644 index 7be0a1c..0000000 --- a/src/api/where/methods/search (stop).md +++ /dev/null @@ -1,16 +0,0 @@ ---- -layout: rest_api -title: search (stop) Method -description: Search for a stop based on its name. -sample_request_url: http://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: - * `http://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](../elements/list-result), so see additional documentation on controlling the number of elements returned and interpreting the results. The list contents are `` elements, so see details about the various properties of the [`` element](../elements/stop). diff --git a/src/api/where/methods/search-route.md b/src/api/where/methods/search-route.md new file mode 100644 index 0000000..cb78ef3 --- /dev/null +++ b/src/api/where/methods/search-route.md @@ -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 `` elements, so see details about the various properties of the [`` element](/api/where/elements/route). \ No newline at end of file diff --git a/src/api/where/methods/search-stop.md b/src/api/where/methods/search-stop.md new file mode 100644 index 0000000..d4a292c --- /dev/null +++ b/src/api/where/methods/search-stop.md @@ -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 `` elements, so see details about the various properties of the [`` element](/api/where/elements/stop). diff --git a/src/api/where/search/index.md b/src/api/where/search/index.md index 9da3ced..2f6e091 100644 --- a/src/api/where/search/index.md +++ b/src/api/where/search/index.md @@ -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/methods/search (stop)) -* [route](/api/where/methods/search (route)) \ No newline at end of file +* [stop](/api/where/methods/search-stop) +* [route](/api/where/methods/search-route) \ No newline at end of file