-
Notifications
You must be signed in to change notification settings - Fork 302
APIs
If an API endpoint is not working, it usually means that data was passed into a page (via front matter) that is causing an issue in the API template.
To fix, you will either:
- fix the specific content page that is causing the issue
- fix the API template to no longer get triggered by this issue
Before you start — Download the JSON View Chrome Extension. This will allow you to see the proper JSON formatting in the browser.
- Identify which API endpoint is not working — usually after someone "the list of authors on the workflow tool doesn't seem to be working anymore..."
- Check the console logs in the workflow tool to see if it's throwing CORS errors:
Failed to load resource: net::ERR_BLOCKED_BY_CLIENT
If so, ping the federalist team in #federalist-support chat on Slack. See this previous thread. - Check to see that the JSON is rendering by opening the LIVE version of the API in the browser
- If the JSON Viewer kicks in, and you see beautifully formatted JSON text, then the API is probably working
- If the JSON Viewer doesn't kick in, and you see minified json data, then there is likely an issue with the API formatting.
- Copy the full text (view source) of the broken API into https://jsonlint.com/ and click "Validate JSON"
- The specific issue with the formatting should be visible.
After a pull request is submitted to include the fix it can be tested by:
- pulling the branch down locally either in the command line or GitHub Desktop tool
- run the site locally in the branch
- visit http://localhost:1313/authors/v1/json/
- Select
view source
and copy the code - Paste the text into https://jsonlint.com/ and click "Validate JSON"
- It shouldn't display any errors
HOME — https://digital.gov/index.json
Communities JSON — https://digital.gov/communities/index.json
Resources JSON — https://digital.gov/resources/index.json
Blog News Posts JSON — https://digital.gov/news/index.json
Events JSON — https://digital.gov/events/index.json
Sources JSON - https://digital.gov/sources/index.json
Single Community — https://digital.gov/communities/agile-lean/index.json
Single Resource — https://digital.gov/resources/omb-memos-circulars-executive-orders-and-other-policies/index.json
Single Blog Post — https://digital.gov/2018/07/17/experiments-in-tweaking-agile-for-ux/index.json
Single Event — https://digital.gov/event/2018/07/26/civic-service-design-tools-tactics/index.json
All Images — https://digital.gov/images/v1/json/
All Topics — https://digital.gov/topics/v1/json/
All Authors — https://digital.gov/authors/v1/json/
A bit about the how we built the terms APIs in HUGO https://discourse.gohugo.io/t/json-api-enpoints-for-taxonomy-terms/24592
🎉Questions? Email digitalgov@gsa.gov