workspace icon indicating copy to clipboard operation
workspace copied to clipboard

API Response codes and error handling

Open donquixote opened this issue 2 years ago • 1 comments

Hello, when an API request fails, currently the response is just a "500 Internal Server Error" with html body. This happens e.g. when I try to create a workspace with a group id that is already used by another workspace.

Alternatives:

  • To align with Nextcloud core or apps, there should be a nested response structure like {ocs: {meta: {statuscode: ***, message: "Id already occupied", status: "failure"}, data: {}}}. The actual http response code would be just 200.
  • Alternatively, to behave more like some other APIs, there could be a response code and message more specific than "500 Internal Server Error".

donquixote avatar Jan 25 '23 16:01 donquixote

Hi @donquixote

Thank you for your feedbacks :+1:

About the OCS model, we are studying the structure of ours API/Rest and determine whether it is suitable for our case.

Alternatively, to behave more like some other APIs, there could be a response code and message more specific than "500 Internal Server Error".

I think we fixed this issue. I keep your issue under your hat if I will meet this error type.

zak39 avatar Aug 04 '23 11:08 zak39