Reputation: 2134
I can curl a website URL by passing on some header params. I am trying to get the same result on the browser but I cannot build the URL for the browser in the right way.
My curl looks something similar
curl -X GET -u '[email protected]' -H "app-key: some-keys" -H "account-email: [email protected]" -H 'Content-Type: application/json' -d 'paused=false' https://api.pingdom.com/api/2.1/checks
When prompted for the password, i can give the password and Iget the JSON response.
Now I try to build the same URL on my browser. The browser prompts for user name and password which I have already given.
Now my URL looks like this.
https://api.pingdom.com/api/2.1/[email protected]&app-key=some-key
I get a forbidden (as JSON reponse) when I try from the browser and from Curl I get the proper JSON response. How can I add header params to a URL when pinging from the browser?
Upvotes: 2
Views: 16038
Reputation: 131027
How can I add header params to a URL when pinging from the browser?
That's not possible. Besides it, from the browser address bar you won't be able to use HTTP methods other than GET
.
So I advise you to you proper tools to target/test your Web API such as Postman or Paw.
Upvotes: 4