Describe the bug
Currently, when calling the listLayers, listMetadataProfiles, listMetricProfiles API and no layers exist, the API responds with a 400 Bad Request.
Why this is problematic:
- Unexpected error handling: Returning a 400 requires clients to handle an exception even when the request is technically valid. “No layers exist” is not an error, it is a legitimate state.
- API design best practices: RESTful API design generally treats “no data” as a valid response, not an error. Returning an empty array is the standard approach for list endpoints.
Expected behavior
- Update APIs to return [] (empty list) when no layers exist.
- Ensure the response code is 200 OK to indicate a successful request.
Relevant logs
{
"message": "No layers found!",
"httpcode": 400,
"documentationLink": "",
"status": "ERROR"
}
Describe the bug
Currently, when calling the listLayers, listMetadataProfiles, listMetricProfiles API and no layers exist, the API responds with a 400 Bad Request.
Why this is problematic:
Expected behavior
Relevant logs