Reputation: 6781
The question is: Where can I see the http requests my browser (Chrome) sends?
Somehow I think this is a very basic question, but I just can't find a good source to get the information I need. I want to know in order to use the Pipedrive API. I need to make a http put request to this URL with a json-type body: "https://api.pipedrive.com/v1/persons/1&api_token=d32c1ca664720eefbd5db15f5d70fd9ebb95e996" . On their api doc page they have a tool to make example calls but I only see the URL-Part, which only contains the API-key. The other data is in the body and I can't seem to set the request up right. Therefor the initial question about where to see the requests send from my browser. I could then inspect the test-api-call.. My request approach so far:
uri = URI("https://api.pipedrive.com/v1/persons/{p_id}&api_token=12345ca664720eefbd5db15f5d70fd9ebb95e996")
Net::HTTP.start(uri.host, uri.port,
:use_ssl => true,
:verify_mode => OpenSSL::SSL::VERIFY_NONE ) do |http|
request = Net::HTTP::Put.new(uri)
request.add_field('Content-Type', 'application/json')
request.body = {'name' => 'XXXXXXXX'}.to_json
response = http.request(request) # Net::HTTPResponse object
puts response.body
end
Upvotes: 3
Views: 6788
Reputation: 1651
If you want to see what the data you send looks like when it's received by the server, you can try pointing your code at httpbin, which will return it back to you, like so:
$ curl -X PUT http://httpbin.org/put -d 'this is a test'
{
"args": {},
"data": "",
"files": {},
"form": {
"this is a test": ""
},
...etc...
So then examine the contents of your response and you'll see what the server received from you and can check if it's right.
Upvotes: 0
Reputation: 146
Not sure if this is what you need, but open the Developer Tools in Chrome, go to the "Network" tab and hit record, then send the request. You'll see this request, and the subsequent ones (if any) listed. Click on it and you'll be able to browse the details.
Upvotes: 10