cs3org / OCM-API

OpenCloudMesh API
38 stars 11 forks source link

ownCloud custom reponse #14

Closed labkode closed 1 year ago

labkode commented 7 years ago

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 commented 7 years ago

Related to #12

DeepDiver1975 commented 7 years ago

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

glpatcern commented 1 year ago

Fixed long ago, closing