11/**
2- Rough Draft Notes:
2+ * @module api/cssiStation
3+ * @category API - CSSI Station Locator API
4+ */
35
4- After testing out the API and looking at the docs, I think the docs are wrong or for an abandoned
5- version of the API.
6+ /**
7+ Rough Draft Notes:
68
79----------------------------------------------------------------------------
810----------------------------------------------------------------------------
@@ -70,55 +72,191 @@ Request parameters and method names are case sensitive
7072Possible Options:
7173- zip: string | number
7274- state: string
73- - lat: string | number
74- - long: string | number
75- - miles: string | number
76- - filters: { lang: string; cpsweek: boolean }
75+ - location: {
76+ lat: string | number;
77+ long: string | number;
78+ miles: string | number
79+ }
80+ - filters: {
81+ lang: string;
82+ cpsweek: boolean
83+ }
84+
85+ Possible Options Combinations:
86+ - zip
87+ - zip + filters
88+ - state
89+ - state + filter.lang
90+ - location
91+ - location + filters (same as location only)
7792
7893Rules:
79- - If zip is provided, cannot provide other options except for filters
80- - If state is provided, cannot provide other options except for filters
81- - lat, long, and miles must be provided together
94+ - CSSIStation is not case sensitive for the path name
95+ - If zip is provided, cannot provide state or location
96+ - If state is provided, cannot provide zip or location
97+ - lat, long, and miles must be provided all or none
8298- filters are optional, either one/none OR both can be sent in according to docs
99+ - filters.cpsweek not compatible with state
100+
101+ ---
102+
103+ Examples:
104+
105+ FIRST 100 STATIONS (no options):
106+
107+ cssiStation()
108+ - returns first 100 stations
109+ - uses base url of /CSSIStation
110+
111+ cssiStation({})
112+ - returns first 100 stations
113+ - uses base url of /CSSIStation
114+
115+ ---
116+
117+ ZIP:
118+ Path - https://api.nhtsa.gov/CSSIStation/zip/63640
119+ cssiStation({ zip: 63640 })
120+
121+ Path- https://api.nhtsa.gov/CSSIStation/zip/63640/lang/spanish
122+ cssiStation({ zip: 63640, filters: { lang: 'spanish' } })
123+
124+ Path - https://api.nhtsa.gov/CSSIStation/zip/63640/cpsweek
125+ cssiStation({ zip: 63640, filters: { cpsweek: true } })
126+
127+ Path - https://api.nhtsa.gov/CSSIStation/zip/63640/cpsweek?lang=spanish
128+ cssiStation({ zip: 63640, filters: { lang: 'spanish', cpsweek: true } })
129+
130+ ---
131+
132+ STATE:
133+ Path - https://api.nhtsa.gov/CSSIStation/state/NV
134+ cssiStation({ state: 'NV' })
135+ cssiStation({ state: 'nv' })
136+ cssiStation({ state: 'Nv' })
137+ cssiStation({ state: 'Nevada' })
138+ cssiStation({ state: 'nevada' })
139+
140+ Path - https://api.nhtsa.gov/CSSIStation/state/NV/lang/spanish
141+ cssiStation({ state: 'NV', filters: { lang: 'spanish' } })
142+
143+ ---
144+
145+ LOCATION (lat, long, miles):
146+ - returns first 100 stations, same as no options
147+ - query string has no effect on returned data
148+ - uses base url of /CSSIStation with query string of ?lat=32.71325&long=-97.28864&miles=50
149+ - filters are added to query string as &lang=spanish &cpsweek=true
150+
151+ Path - https://api.nhtsa.gov/CSSIStation?lat=32.71325&long=-97.28864&miles=50
152+ All paths here use query string to represent passed options as seen in the path above.
153+
154+ cssiStation({
155+ location: {
156+ lat: 32.71325,
157+ long: -97.28864,
158+ miles: 50
159+ }
160+ })
161+
162+ cssiStation({
163+ location: {
164+ lat: 32.71325,
165+ long: -97.28864,
166+ miles: 50
167+ },
168+ filters: {
169+ lang: 'spanish'
170+ }
171+ })
172+
173+ cssiStation({
174+ location: {
175+ lat: 32.71325,
176+ long: -97.28864,
177+ miles: 50
178+ },
179+ filters: {
180+ cpsweek: true
181+ }
182+ })
183+
184+ cssiStation({
185+ location: {
186+ lat: 32.71325,
187+ long: -97.28864,
188+ miles: 50
189+ },
190+ filters: {
191+ lang: 'spanish',
192+ cpsweek: true
193+ }
194+ })
195+
196+ ----------------------------------------------------------------------------
83197
84198By zip:
85199
86200Uses url path to specify zip code:
87- https://api.nhtsa.gov/CSSIStation/zip/63640
201+ - https://api.nhtsa.gov/CSSIStation/zip/63640
88202
89203Fitering by lang:
90- https://api.nhtsa.gov/CSSIStation/zip/63640/lang/spanish
91-
92- Apparently you can pash whatever language string you want after the /lang/ part of the path, it doesn't have to be /lang/spanish as described in the docs.
93- It returns the same data no matter the path after /lang (e.g. /lang/blahblahblah returns the same data as /lang/spanish)
204+ - https://api.nhtsa.gov/CSSIStation/zip/63640/lang/spanish
205+ - Apparently you can pash whatever language string you want after the /lang/ part of the path, it
206+ doesn't have to be /lang/spanish as described in the docs.
207+ - It returns the same data no matter the path after /lang (e.g. /lang/blahblahblah returns the same
208+ data as /lang/spanish)
94209
95210Filtering by cpsweek:
96- https://api.nhtsa.gov/CSSIStation/zip/63640/cpsweek
211+ - https://api.nhtsa.gov/CSSIStation/zip/37066/cpsweek
212+
213+ Filtering by cpsweek and lang as query string:
214+ - https://api.nhtsa.gov/CSSIStation/zip/37066/cpsweek?lang=spanish
97215
98216---
99217
100218By state:
101219
102220Uses url path to specify state:
103- https://api.nhtsa.gov/CSSIStation/state/NV
221+ - https://api.nhtsa.gov/CSSIStation/state/NV
222+ - state can be NV, nv, nevada, Nevada, etc.
104223
105224Filtering by lang:
106- https://api.nhtsa.gov/CSSIStation/state/NV/lang/spanish
107-
108- Apparently you can pash whatever language string you want after the /lang/ part of the path, it doesn't have to be /lang/spanish as described in the docs.
109- It returns the same data no matter the path after /lang (e.g. /lang/blahblahblah returns the same data as /lang/spanish)
110-
111- Filtering by cpsweek:
112- https://api.nhtsa.gov/CSSIStation/state/NV/cpsweek
113-
114- doesn't seem to work, gives 404 error
225+ - https://api.nhtsa.gov/CSSIStation/state/NV/lang/spanish
226+ - Apparently you can pash whatever language string you want after the /lang/ part of the path, it
227+ doesn't have to be /lang/spanish as described in the docs.
228+ - It returns the same data no matter the path after /lang (e.g. /lang/blahblahblah returns the same
229+ data as /lang/spanish)
230+
231+ Filtering by cpsweek (DOES NOT WORK WITH STATE!):
232+ - https://api.nhtsa.gov/CSSIStation/state/NV/?cpsweek=true <-- ignores query, returns same data as
233+ /state/NV
234+ - https://api.nhtsa.gov/CSSIStation/state/NV/cpsweek <-- gives 404 error
235+ - https://api.nhtsa.gov/CSSIStation/cpsweek/state/NV <-- gives 404 error with differing path
236+ order
237+
238+ Filtering by cpsweek and lang (DOES NOT WORK WITH STATE!):
239+ - https://api.nhtsa.gov/CSSIStation/state/NV?cpsweek&lang=spanish <-- ignores query, returns same
240+ data as /state/NV?lang=spanish
241+ - https://api.nhtsa.gov/CSSIStation/state/NV/cpsweek?lang=spanish <-- gives 404 error
242+ - https://api.nhtsa.gov/CSSIStation/state/NV/lang/spanish/cpsweek <-- gives 404 error
243+ - https://api.nhtsa.gov/CSSIStation/state/NV/cpsweek/lang/spanish <-- gives 404 error
115244
116245---
117246
118247By lat, long, and miles:
119248
120- It doesn't appear the query string does anything, even with the example in the official docs.
121- If you change the lat and long and miles the results are the same as if you has just hit the baseURL
249+ In real world use, this will return the same data no matter what query string you send, the same as
250+ if you sent no query string at all. It appears the query string does nothing for this endpoint as
251+ described in the official docs. You will get the same 100 stations returned no matter what query
252+ string you send.
253+
254+ After testing out the API and looking at the docs, I think the docs are wrong or at the very least
255+ the lat/long/miles query is broken or abandoned, possibly in favor of the official site and form at:
256+ https://www.nhtsa.gov/equipment/car-seats-and-booster-seats#installation-help-inspection
257+
258+ It doesn't appear the query string does anything, even with the example in the official docs. If you
259+ change the lat and long and miles the results are the same as if you has just hit the baseURL
122260of https://api.nhtsa.gov/CSSIStation with no query string.
123261
124262I'm not sure if this is a bug or if the docs are wrong.
@@ -132,45 +270,67 @@ first 100 stations in the database.
132270
133271If you go here:
134272https://api.nhtsa.gov/CSSIStation?lat=32.71325&long=-97.28864&miles=50
273+
135274You get data returned with:
136275StartLatitude: 42.75565
137276StartLongitude: -92.79417
138277
139- Also the same data when using:
278+ Which does not match the lat and long you sent in the query string. It should be:
279+ StartLatitude: 32.71325
280+ StartLongitude: -97.28864
281+
282+ This will also return the same data as when you send the query string:
140283https://api.nhtsa.gov/CSSIStation
141284
142- Which does not match the query string. This appears to be broken on the NHTSA side.
285+ This appears to be broken on the NHTSA side, possibly because whatever API they were using to
286+ convert lat and long to a geo location is no longer available or because they are using a different
287+ internal API behind an auth wall for their offical seat install locator site at
288+ https://www.nhtsa.gov/equipment/car-seats-and-booster-seats#installation-help-inspection and have
289+ abandoned this api.nhtsa.gove/CSSIStation API.
143290
144291---
145292
146293Filters:
147294
148- Cannot use with lat, long, and miles, but more accurately I don't know how to use it with lat, long,
149- and miles query string or what the query names for filters are because query strings don't do
150- anything for the language filter.
295+ Cannot use with lat, long, and miles, or more accurately, query strings do nothing for this endpoint
296+ so determining if you can use filters with lat, long, and miles is impossible.
151297
152298lang:
153299
154- By zip:
155- https://api.nhtsa.gov/CSSIStation/zip/63640/lang/spanish
156-
157- By state:
158- https://api.nhtsa.gov/CSSIStation/state/NV/lang/spanish
159-
160300Apparently you can pass whatever language string you want after the /lang/ part of the path, it
161301doesn't have to be /lang/spanish as described in the docs. It returns the same data no matter the
162302path after /lang (e.g. /lang/blahblahblah returns the same data as /lang/spanish)
163303
164- cpsweek:
304+ By zip with lang:
305+ - https://api.nhtsa.gov/CSSIStation/zip/63640/lang/spanish
165306
166- By zip:
167- https://api.nhtsa.gov/CSSIStation/zip/63640/cpsweek
307+ By zip with lang and cpsweek (cpsweek sent as query string = true):
308+ - https://api.nhtsa.gov//CSSIStation/zip/67951/lang/spanish?cpsweek=true
309+ - Returns: Count = 0 because there are no stations with CPSWeekEventFlag = "Yes" in zip 63640 but will
310+ still return 200 status code and empty Results[]
311+
312+ By state with lang:
313+ - https://api.nhtsa.gov/CSSIStation/state/NV/lang/spanish
314+
315+ By state with lang and cpsweek (cpsweek sent as query string = true):
316+ - https://api.nhtsa.gov/CSSIStation/state/NV/lang/spanish?cpsweek=true <-- responds with same data
317+ as above, query strings do nothing it appears, includes stations with CPSWeekEventFlag = "No" when
318+ it should only include stations with CPSWeekEventFlag = "Yes"
319+
320+ cpsweek:
168321
169- By state (DOES NOT WORK) :
170- https://api.nhtsa.gov/CSSIStation/state/NV /cpsweek <-- gives 404 error
322+ By zip With cpsweek :
323+ - https://api.nhtsa.gov/CSSIStation/zip/63640 /cpsweek
171324
325+ By zip with cpsweek and lang as query string:
326+ - https://api.nhtsa.gov/CSSIStation/zip/37066/cpsweek?lang=spanish
327+ - Returns: Count = 0 because there are no stations with CPSWeekEventFlag = "Yes" in zip 63640 that
328+ have spanish speaking technicians but will still return 200 status code and empty Results[]
172329
173- Does not work with state, gives 404 error if added to the path as described in the docs
330+ By state with cpsweek (DOES NOT WORK):
331+ - https://api.nhtsa.gov/CSSIStation/state/NV?cpsweek=true <-- ignores query, returns same data as /state/NV
332+ - https://api.nhtsa.gov/CSSIStation/state/NV/cpsweek <- gives 404 error
333+ - https://api.nhtsa.gov/CSSIStation/cpsweek/state/NV <- also gives 404 error with differing path order
174334
175335---
176336
0 commit comments