how to reverse engineer an http API call using REST console

12,503

The form is posting all that JSON under the field criteria. You can see this in the screencap of the chrome dev console you posted.

Just start your raw body in rest console with criteria= and make sure the json has been url-encoded. That should do it.

No authentication is needed because none is passed through the headers in your screencap. Any cookies you have when you load the page normally will also be loaded through rest console, so you don't need to worry about explicitly setting them.

Share:
12,503
abbood
Author by

abbood

Email me at [email protected] Fork me on github Add me on linkedin Work with me at Toters Delivery Careers

Updated on June 04, 2022

Comments

  • abbood
    abbood almost 2 years

    I'm trying to replicate a request I make on a website (ie zoominfo.com) using the same http POST parameters using chrome rest console, but it fails for some reason. I'm not sure if there is a missing field or it's not working because the origin of the request isn't valid.. can someone point me out in the right direction? Below is a detailed explanation of the experiment:


    ORIGINAL CASE

    basically if I go to zoominfo.com (registered and all) I see a form page that I need to fill:

    enter image description here

    if I hit enter.. the site makes an ajax call. If I open the chrome web dev tools, and open the network tab, I see the details of the ajax call:

    enter image description here

    notice the body of the POST has the name John Becker in it:

    {"boardMember":{"value":"Include","isUsed":true},"workHistory":{"value":"CurrentAndPast","isUsed":true},"includePartialProfiles":{"value":true,"isUsed":true},"personName":{"value":"john%20becker","isUsed":true},"lastUpdated":{"value":0,"isUsed":true}}

    the response is shown under the respones tag:

    enter image description here


    WHAT I'M TRYING TO DO

    basically replicate what i've done above using a REST console (note: so there is nothing illegal here.. i'm just replacing a chrome browser action with a rest client action.. i'm not hacking anyone and i'm not getting information I can't get the normal way, but if someone feels otherwise.. please let me know)..

    so I plug in the same parameters as above into the rest console:

    enter image description here

    now i'm not sure about authentication.. but just to be safe, i entered the same user name and pwd i have for the site into the REST console:

    enter image description here enter image description here

    but then I keep on getting an error as a response to my rest console's request:

    enter image description here


    UPDATE: CORRECT ANSWER: so according to JMTyler's answer.. I had to simply include criteria in the RAW body, and convert it to url encoding.. in addition to that, I had to explicitly set the encoding in the rest console body..

    looking at the chrome inspector more closely, it turns out that I simply had to click on view source: enter image description here

    to get the url-encoded value that I needed to put in the RAW body in the rest console: enter image description here

    I also had to set encoding to gzip,deflate,sdch and things worked fine!