问题是:在哪里可以看到我的浏览器 (Chrome) 发送的 http 请求?
不知何故,我认为这是一个非常基本的问题,但我找不到一个很好的来源来获取我需要的信息。我想知道为了使用 Pipedrive API。我需要使用 json 类型的主体向此 URL 发出 http put 请求:“ https://api.pipedrive.com/v1/persons/1&api_token=d32c1ca664720eefbd5db15f5d70fd9ebb95e996 ”。在他们的 api doc 页面上,他们有一个工具来进行示例调用,但我只看到 URL-Part,它只包含 API 密钥。其他数据在正文中,我似乎无法正确设置请求。因此,关于在哪里查看从我的浏览器发送的请求的最初问题。然后我可以检查 test-api-call .. 到目前为止我的请求方法:
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
Run Code Online (Sandbox Code Playgroud)