Qlik Community

Qlik Connectors Discussions

Discussion Board for collaboration regarding Qlik Connectors.

henrikalmen
Contributor

Taking care of 4xx response body in REST connector

Is there a way to take care of the response body information when the API returns 4xx response code?

In my case, the API I'm using responds with a highly relevant error message along with the 4xx status code. If I could parse the body of that error message, I could let the script fix the error that is mentioned and retry the request. But I can't find a way to retrieve that response, the rest connector raises a script error and I can't seem to get any information into QlikView from that response when the connector encounters this error.

Error handling in QV does not seem to do the trick. If I do this:

trace $(ScriptError) # $(ScriptErrorDetails)

I get this:

File Has Wrong Format # QVX_UNEXPECTED_END_OF_DATA: The remote server returned an error: (404) Not Found.

But the actual response body from the server is the following, and I really want to get the value of the message parameter:

{

  "error": {

  "code": "item.not-found",

  "message": "Item with id 440313 was not found",

  }

}

Tags (1)
Community Browser