Ask HN: What is your go-to example for a good REST API?
401 pointsI tend to always look to api.github.com when I need a little inspiration.
Anyone have some good examples of a particularly well laid out API?
Anyone have some good examples of a particularly well laid out API?
Comments (182) 67 threads
Show all comments
Showing thread 9 of 67
To summarize: send a 202 for the initial request, redirecting to a job URL. The client polls on the job URL, which returns 200 with progress information until it's done, when it returns a 303 redirecting to the final output.
One particular problem spot is that many http libraries automatically follow the 303 redirect, and some even follow the 202 redirect.
I definitely think we would have been better off just putting status and final location information as JSON attributes in the body rather than putting it in HTTP response codes and Location headers. Non-standard, but much less confusing for our customers.
Long poll lets the polling be efficient.
Says who?
Maybe not "streaming". Maybe not "real time". But certainly asynchronous.
[1] https://developers.digitalocean.com/documentation/v2/