OCM-API icon indicating copy to clipboard operation
OCM-API copied to clipboard

ownCloud custom reponse

Open labkode opened this issue 9 years ago • 2 comments

Almost every response contains the redundant ownCloud/NextCloud meta envelope, which is a redundancy on top of the HTTP error code. The HTTP error code already told us that the request was wrong, there is no reason to return this information.

HTTP/2.0 400 Bad Request

{

    "meta": {
        "status": "error",
        "statusCode": 400
    }

}

What makes sense is to provide useful information for the end user in the response, something like this:

HTTP/2.0 400 Bad Request

{
    "code": 3,
    "message": "invalid token",
    "documentation": "url pointing to the endpoint definition"
}

As far as I've seen in the last years, this is what modern APIs return. There are some cases the 'statusCode' is 997, and that error code is not documented at all and is coming from ownCloud/NextCloud implementation. Idem for successful responses, the data envelope could be avoided as this API isn't HATEOAS oriented.

labkode avatar Nov 17 '16 12:11 labkode

Related to #12

labkode avatar Nov 17 '16 13:11 labkode

There is absolutly no need in carrying around this meta blob.

DeepDiver1975 avatar Nov 18 '16 19:11 DeepDiver1975

Fixed long ago, closing

glpatcern avatar Jul 24 '23 08:07 glpatcern