-: Okay, so we have discussed the most popular
and common status codes in the three groups of status codes
but actually there are many non-standard codes
which are not part of the W3C standard of the HTTP protocol.
These non-standard codes introduced by various companies
and organizations and are usually used for a very
specific goals that are relevant for these companies.
Such companies include Twitter, Apache, Shopify
and lots more.
Each one of them presented new status codes that are used
by the respective API.
Now, one of the most well-known, non-standard codes are part
of the WebDAV protocol that included some status codes
for document editing.
WebDAV adds many status codes, and as mentioned
almost all of them relevant for document editing.
So let's take a look at one of those
status code introduced by WebDAV.
And this is the 207 - Multi Status.
So when exactly are we going to use this status code?
This is used for cases where multiple entities are handled
each has its own status.
For example, when sending a list of 10 entities
and saving them in the database
then some might fail, and some might succeed.
And we needed to tell the client which entities were failed
and which succeeded.
So with the regular status, we can't do it
because the status returned is a single number
a single status, and we cannot separate the status
for different entities.
But with 207, we can do it.
For example take a look at this example
of the 207 Multi Status.
And as you can see this snippet contains
two responses for two entities.
In this case, both of them were successful and
their respective status is 200.
Okay, but you can also return
other status code for each entity.
Now remember, when returning the 207 Multi Status code
make sure that the client of the API expects such a status.
Remember that we say that most clients are looking for the
200 status and they consider any other status as an error.
So again, make sure the client knows how to
handle a 207 Multi Status code.