Retrieving response body from Skuid rest model

  • 1
  • Question
  • Updated 2 years ago
  • Acknowledged
I have a rest model that I'm updating and I can't seem to find a way to access the response body. I'm returning an error message that I would like to have displayed on the page in the body. Does anyone know how I can access the response body?
Photo of wun

wun

  • 150 Points 100 badge 2x thumb

Posted 2 years ago

  • 1
Photo of Stephen Sells

Stephen Sells, Official Rep

  • 16,856 Points 10k badge 2x thumb
Would you mind providing a picture of the error and providing some more detail into what your set up is?
Photo of wun

wun

  • 150 Points 100 badge 2x thumb
I have a rest model that calls into an API. When I update the model, it makes a call to the API and some validation takes place there. If validation does fail, the API returns a 400 Bad Request along with some error messages in the body of the response. When I view the list of errors that are on the result object after the save, the error says "Bad request" which looks like the status code. What I would like is to get the error messages from the response body, which I haven't been able to find. I hope that clarifies it some.
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
Wun,

It looks like Skuid has an API call to get the error message->  skuid.ajax.getErrorMessage

Maybe add a snippet that runs on model load to get the output of this call?

Thanks,

Bill
Photo of wun

wun

  • 150 Points 100 badge 2x thumb
Bill, can you elaborate more on this? Maybe provide an example. I don't see the method getErrorMessage from Chrome's Developer's Tools. Also, looking at Skuid's documentation on skuid.ajax, I don't see anything documented about this method either.

https://docs.skuid.com/latest/en/skuid/api/skuid_ajax.html
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
Wun,

I actually looked at the Developer Console in Chrome to find that API call.  If you open the console, type 'skuid'.  You can then drill into the different methods.

The other thing to look at is this posting:  https://community.skuid.com/skuid/topics/how_does_skuid_handle_session_timeout_when_using_table_filt...

I think you can use this sample to get the error message from Salesforce.

Thanks,

Bill