In #2552735: Add endpoint validation we added endpoint validation, but not surprisingly there are some edge cases that our approach there doesn't cover.
At the moment I have an endpoint for which the metadata API returns a valid response, but the actual SODA2 API returns a 500 error:
- Metadata/200: https://data.seattle.gov/api/views/rhf2-u5fm.json
- SODA2/500: https://data.seattle.gov/resource/rhf2-u5fm.json
So we need to tune our approach to validation.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | socrata-validate-2689575-6.patch | 2.05 KB | arh1 |
| #4 | socrata-validate-2689575-4.patch | 802 bytes | arh1 |
Comments
Comment #2
arh1 commentedComment #3
papagrandeMight be worth pinging Socrata on that one if their APIs return different data.
Comment #4
arh1 commentedLet's just validate against a (limit 1) SODA2 API request. If there was a reason we didn't do that the first time we looked at validation, I'm not sure what it was :)
Patch attached.
Comment #5
papagrandeI was able to put in
https://data.seattle.gov/api/views/rhf2-u5fm.jsonas an endpoint and it validated, but it shouldn't. The endpoint then doesn't show up on the view content list.Comment #6
arh1 commentedAh, good point. That's a separate case, but also important to catch. We should ensure we only allow SODA2 API URLs when we validate.
The attached patch just does some string-matching for that. I'm not sure if there's a better way to check...
I also tweaked wording of the validation error messages, as well as the URL form field help text.
Comment #8
papagrandeLooks good. Committed.
I took out your comment
because according to https://dev.socrata.com/docs/endpoints.html, that is the correct way to format the URL.
Comment #9
papagrandeI'm reopening this because I'm able to put in https://data.seattle.gov/resource/55n4-ddnu.json, which comes from https://data.seattle.gov/Transportation/Downtown-Seattle-Bike-Racks/55n4... API, as a valid endpoint. However, that is a map and not a dataset so a query to https://data.seattle.gov/resource/55n4-ddnu.json returns an empty array. We could test for that, but it would be nice if the Socrata metadata API offered an easier way to validate that an endpoint is indeed a dataset with valid data.
Comment #10
papagrandeMoved the latest issue to #2700071: Endpoint Validation Fails on Map Endpoints since the earlier patches are already committed.