Media Type for errors?

85 views
Skip to first unread message

James Nail

unread,
Mar 16, 2016, 4:15:26 PM3/16/16
to API Craft
Has anyone here used a specific media type to return API errors?

If so, which one(s)?

Which would you recommend?

I know about Mark Nottingham's application/problem+json type, but I figured I'd try to get some opinions before just going with that one by default.

Thanks,

James

Adrien Risser

unread,
Mar 16, 2016, 4:18:56 PM3/16/16
to api-...@googlegroups.com
I'm using Ben Longden's "application/vnd.error+json" for my current development.

As my preferred hypermedia type is HAL+json, it's a good start.
I've extended it with an explicit "status" property, a misc "data" and a "stack" (only in dev environment).


Cheers,

--
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-craft+...@googlegroups.com.
Visit this group at https://groups.google.com/group/api-craft.

For more options, visit https://groups.google.com/d/optout.



--
Adrien Risser,
Freelance Node.js Consultant

Alexander Zeitler

unread,
Mar 16, 2016, 4:25:17 PM3/16/16
to api-...@googlegroups.com

Hi,

 

we’re using application/problem+json.

 

Alex

--

Pete Johanson

unread,
Mar 16, 2016, 4:35:54 PM3/16/16
to API Craft
We're happily using application/problem+json. I particularly appreciate the base core combined with the 'type' property, allowing for both generic handling plus type specific handling as needed.

-pete

--

James Nail

unread,
Mar 16, 2016, 8:56:13 PM3/16/16
to API Craft
Interesting!  I ran across that one earlier in the day, but honestly, since I hadn't heard of it before, I didn't give it serious consideration.
It's interesting that it's HAL-compatible, as it makes a lot of sense to ensure your errors are actionable in a generically programmatic way.

Przemek Wesołek

unread,
Apr 1, 2016, 8:17:36 AM4/1/16
to API Craft
BTW, application/problem+(json|xml) has been promoted to RFC: http://tools.ietf.org/html/rfc7807

Przemek
Reply all
Reply to author
Forward
0 new messages