JSON API Errors =============== See `the JSON API error spec `_ and `examples `_. Deviations ---------- LeafLink API errors deviate from JSON API errors in two ways: 1. | LeafLink APIs do not wrap request bodies in the :code:`data` top level key. Thus, error :code:`source.pointer` properties will never begin with :code:`/data/`, they will begin with :code:`/`. 2. | Error responses will return a :code:`Content-Type` of :code:`application/json`, not :code:`application/vnd.api+json`. This is because we do not strictly meet the JSON API error spec. Remarks ------- Error `title` properties should *always* be the same for the same error type. Example: .. code-block:: javascript // No { "errors": [ { ..., "title": "Product #123 not found." }, { ..., "title": "Order #456 not found." } ] } // Yes { "errors": [ { ..., "title": "Not found.", "detail": "Product #123 could not be found." }, { ..., "title": "Not found.", "detail": "Order #456 could not be found." } ] }