REST API debugging

Matt SonesMatt Sones 💎💎💎
edited December 13, 2019 in Questions
Is there any way I can actually see the JSON that gets sent for my POST or GET requests?

Thanks!

Comments

  • edited March 2, 2017
    Yes, from Chrome, go to the Console, then go to the "Network" tab, and limit to "XHR". Then take whatever action causes your REST API request to be made. (If the request happens on page load, you will need to reload your page with the Console still open to see the requests that occur on page load).

    The requests will look like this:

    image
    Click on "apexremote". This will bring up a panel where you need to scroll down to the very bottom and then click on "data":

    image

    image

    Then copy the string value of the first item in the data array (If multiple Models are being saved / queried in close proximity, there may be multiple entries in this data array), and paste it into a text editor or JSON pretty printer (e.g. http://jsonprettyprint.com/ ), remembering to remove the leading and trailing spacesso that you get a nicer JSON representation of the request, e.g.

    image




  • Matt SonesMatt Sones 💎💎💎
    edited February 10, 2017
    awesome. Thanks, Zach!
  • Anna WiersemaAnna Wiersema 🛠️ 
    edited December 13, 2019
    Thanks for the great question & answer! This is now documented for posterity (well, documented in another place as well: http://help.skuidify.com/m/models-conditions-filters/l/455021-troubleshooting-and-debugging-for-external-data-sources).
  • Matt SonesMatt Sones 💎💎💎
    edited February 10, 2017
    Nice work, Anna.

    Just a quick note, you may want to update step 3 to include the fact that we need to be on the Headers tab when you click apexremote. I believe chrome defaults to your last tab, and I was on the Results tab at first, which caused a moment of confusion.

    So, Step 3 should be:
    1. apexremote
    2. Headers
    3. Request Payload
    4. Data
  • Anna WiersemaAnna Wiersema 🛠️ 
    edited December 13, 2019
    Thanks! Implemented. Your word is my command.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!