Aaagh! Getting some random old person flashbacks.
Kids. I r-remember a day… You won’t believe this… I got a 404 error page… It was otherwise a normal 404 page with a normal message on it, but it had a giant ad on it… like “while you’re here, how about you buy this stuff”… It was hell… You’ve got no idea how lucky you kids are with uBlock…
{ "ok": false }
{ "ok": false }
{ "ok": "false" }
{ "false": "ok" }
$false=true
{ "ok": "no" }
error = true with no description or answer is basically ten years of searching stackoverflow and reddit threads for an answer.
It’s not us, it’s you
It’s us: 5xx
It’s you: 4xx
Congratulations! You failed.
Every time I see someone recommend this at work I die a little inside. Like… C’mon!
Marketo my
belovedthe bane of my existence. Actually without a doubt the worst API I’ve ever worked with in my career. The response schemas are random and a 200 means nothing because it might also include a “success”: “false”". Our backend API is Python and we have strict typing rule but Marketo really makes that difficultJSON API almost always means “not REST”. In other words, it works as intended.
how would you return metadata or more detailed error codes?
The argument probably goes something like " if you adhere strictly to REST the error codes are all you need" and then metadata can be sent in response headers.
how should a REST API respond to the client sending a URL the ends in a string instead of a numeric ID? like api.social/users/ceeforayteen instead of api.socail/users/11037
I would do a 400 (Bad Request). Then, with varying amounts of detail depending on the scale of the project and the framework capability, the response body would be something like: { “error”:true, “reason”: “validation”, “detail”: “user id should be numeric” }
Depends on the verb and the application. If the string is valid 200, if it isn’t 400, 404.
It’s still just another type of ID so you can do lookups on it. Nothing would change. UUIDs are used all the time.
Either way, the webpage didn’t load. And fuck literally everyone involved for not explaining to me what I need to do to fix it.
I’d rather see this than actual rest or the more popular use the bits of rest that are convenient.