Home > Net >  Understanding the GET/POST/DELETE requests on a basic level?
Understanding the GET/POST/DELETE requests on a basic level?

Time:10-31

I'm currently learning to use REST API (from WooCommerce in this case) and got some basic questions:

How to see complete request string in Postman software? I'm testing a simple GET request which works great with for example:

<host>/wp-json/wc/v3/products

to receive the product list. In this case I use the authorization tab to enter my user/pass as Basic Auth. I also tested curl.exe using another simple Windows command prompt. This also returned product list:

curl.exe <host>/wp-json/wc/v3/products -u mykey:mysecret

What is the difference between them? The last example is a simple GET, i assume, although it's not stated. How about POST or DELETE etc? This is what i don't understand: A https request can only have an address and eventual parameters. Where and how does "GET" come into the picture?! If possible, I would like the see the complete URL request (as one string) from the working Postman example?

My last question is about testing the same method on another server/service which is not WooCommerce. Afaik this service is created with something called swagger:

curl "<host>/orderapi/item" -H "accept: application/json" -H "X-Customer: <customer>" -H "X-ApiKey: <mykey>" -H "X-ApiSecret: <mysecret>" -H "Content-Type: application/json"

This also returns a list of, in this case orders instead of products. All good.

But for this example I haven't figured out how to achieve the same request in Postman. What auth method should I use? And again, I don't understand the GET/POST/DELETE thing. And I also would like to see the complete request as one-string.

CodePudding user response:

1) How to see complete request string in Postman software? I would like the see the complete URL request (as one string) from the working Postman example

On version 9.x.x:

enter image description here

and where you can see more details about requests and responses.

Postman also lets you import curl commands, so you don't need to manually prepare the request, you can only paste the curl command in Postman.

There are many resources online on the specifics, e.g. how to import a curl command.

  • Related