Budibase / budibase

Low code platform for building business apps and workflows in minutes. Supports PostgreSQL, MySQL, MariaDB, MSSQL, MongoDB, Rest API, Docker, K8s, and more 🚀
https://budibase.com
Other
21.87k stars 1.51k forks source link

Public API: When retrieving an empty row, a 400 error is thrown #5941

Closed theetrain closed 1 year ago

theetrain commented 2 years ago

Hosting

Describe the bug

When using the Public API to retrieve a single row (endpoint for retrieving a single row) and the provided row ID corresponds to a non-existing entry, a 400 error is thrown when it should be a 404.

To Reproduce Steps to reproduce the behavior:

  1. Submit a valid request to /api/public/v1/tables/<table-id>/rows/<row-id> where table-id or row-id corresponds to missing data
  2. Observe 400 response:
    {
       "message": "missing",
       "status": 400
    }

Expected behavior

In step 2 above, observe 404 response using RFC 7807-compliant problem:

{
    "title": "table not found",
    "status": 404
}

Note: can also be 'row not found' depending on the evaluation

Desktop (please complete the following information):

Additional context

Perhaps a this code (L34) should be checked for an empty reponse in the event there's missing data:

https://github.com/Budibase/budibase/blob/77d7a5ed70d84bd4171038af37d5abbc7310fc52/packages/server/src/api/controllers/row/index.ts#L33-L43

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity.