Coder
Coder

Reputation: 7761

Converting a Postman request to curl

I am calling my Java webservice (POST request) via Postman in the following manner which works perfectly fine (i.e. I can see my records getting inserted into the database):

enter image description here

And, here's how the contents inside the Headers(1) tab look like:

enter image description here

Instead of calling it via Postman, I have to call the same request in PHP using cURL. I am wondering if there's a way to export this command to a curl command so that I could use it in my PHP code? I have found the opposite approach at many places online where someone is asking to convert a curl based request to Postman but couldn't figure out how to do the opposite.

I found this question for curl to Postman: Simulate a specific CURL in PostMan

Upvotes: 763

Views: 735467

Answers (10)

Tnadev
Tnadev

Reputation: 10112

Latest version 8.x:

  • Find Code symbol on the right side of the postman. enter image description here

  • Select cURL from the dropdown. enter image description here

Upvotes: 12

iloo
iloo

Reputation: 996

For those who use v7.36.5 for Ubuntu, or similar. Instead of the </> icon, there is a clickable "Code" text:

enter image description here

Upvotes: 14

Jose M. Gonz&#225;lez
Jose M. Gonz&#225;lez

Reputation: 15120

Open code window

You can see the button </> Code icon in right side of the Postman app (attached screenshot).
Press it and you can get your code in many different languages including PHP cURL

Code snippets window

Upvotes: 1457

Hadesh
Hadesh

Reputation: 59

Select </> Code icon from right side in Postman.

Upvotes: 5

Jai Kumaresh
Jai Kumaresh

Reputation: 835

For Postman Version 7.36.5 (7.36.5)

enter image description here

Upvotes: 1

Mostafa Shamin Yeasar
Mostafa Shamin Yeasar

Reputation: 436

Steps:

  • Open Postman
  • Open your request
  • Select </> icon from right side bar
  • Select cURL from dropdown (if not cURL is there by default)
  • Copy the code and use.

Upvotes: 10

Deepak Rajpal
Deepak Rajpal

Reputation: 1021

enter image description hereTo extend the existing answers, there is an option to generate PHP ready cURL code if needed. With latest Postman, you will find dropdown for PHP - cURL and other languages.

See screenshot:

Upvotes: 4

vivekagarwal277
vivekagarwal277

Reputation: 595

The first answer here works with the older versions of Postman. With the latest releases in 2021 the cURL can be found clicking this icon (circled in red) enter image description here

Upvotes: 38

TheFreddyKilo
TheFreddyKilo

Reputation: 417

If you're like me running MacOS and still have Postman v7, you have to click the ellipses here to find the code option

Upvotes: 8

Artem Bernatskyi
Artem Bernatskyi

Reputation: 4687

Starting from Postman 8 you need to visit here

enter image description here

Upvotes: 203

Related Questions