While I was troubleshooting API calls this week with some of our API developers, I came across a nice little trick I hadn’t used before.
I talked in my previous post how you can use the Google Network Debugger to capture the API calls done when you’re interacting with a browser.
What you can even do is capture the API Call as a “curl” command.
See below how to do it:
Why is that cool? Well, you can then leverage cURL straight-away to make the API call directly by pasting the code copied:
$ curl 'https://api.marketplace.cloud.vmware.com/products/search?textsearch=grafana&ownorg=false' \ > -H 'authority: api.marketplace.cloud.vmware.com' \ > -H 'accept: application/json, text/plain, */*' \ > -H 'csp-auth-token: eyJhbGciO_blablabla' \ > -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36' \ > -H 'origin: https://marketplace.cloud.vmware.com' \ > -H 'sec-fetch-site: same-site' \ > -H 'sec-fetch-mode: cors' \ > -H 'sec-fetch-dest: empty' \ > -H 'referer: https://marketplace.cloud.vmware.com/' \ > -H 'accept-language: en-GB,en-US;q=0.9,en;q=0.8,fr;q=0.7' \ > --compressed
Now that’s cool but what if you want to save this specific API call to your library or re-use it elsewhere? Well, you can import it into Postman:
In this quick video, I import the API call I imported from Chrome straight into Postman. Nice!
This is great for anyone who wants to understand API calls executed when you interface with your platform.
Thanks for reading.