WordPress REST API response is empty in browser and script, but not in Postman

The answer for me was setting the X-WP-Nonce with the wpApiSettings.nonce in the headers.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)