how to reverse engineer an http API call using RES

2019-03-21 13:20发布

问题:

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:

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:

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:


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:

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:

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


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:

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

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

回答1:

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.



回答2:

Reading your problems I'll make an educated guess: zoominfo does not provide an RESTful API. Rest-Console understands and uses HTTP Authentication, which is different from the authentication handler zoominfo implemented.

A possible way to work around may be: Make a call to the login-page via rest console. you'll get back cookies and a lot more. In subsequent requests to zoominfo be sure to include those cookies (likely holding some session information) in your request, therefore acting like a browser.



标签: json api http rest