Access and show response body from api

I get data from an API and show it in a table. I have another api to delete and another for put, post,…

for example the API delete Endpoint gives me Validation messages in the response body which I want to display the user if a row can’t be deleted. How can I access this message? I tried, but get

code for the delete button:

.then(res => {
showAlert(‘Datensatz erfolgreich gelöscht’,‘success’);;
error => {
showAlert('Datensatz kann nicht gelöscht werden: '+ error[0].text, ‘error’)

the response body from delete api is:

“text”: “Die Prüfung ist …”

so, I tried to access this message with: error[0].text

can anybody help me, please?


Hi! Is api1 the name of the API that returns that text? Then you have to use[0].text to access it.

hi and thx, I can access it!