Category: How do I do X?
Updated

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

Access and show response body from api

Issue

I am trying to display a validation message to the user when a row cannot be deleted using an API. The message is in the response body of the delete API. I am trying to access this message using error[0].text, but it's not working. Can someone help me with this?

Resolution

The issue is that the response body from a delete API endpoint contains validation messages that need to be displayed to the user. To access this message in the code, the solution is to use api1.data[0].text. This will give you the text message in the response body of the delete API endpoint. Use this in conjunction with your error handling code to display the message to the user when there is an error deleting a row in your table. An example of this code is provided above.