Skip to main content

Code generation

Postman is able to generate the relevant code to make requests in a variety of languages.

In this example, we will generate the appropriate authentication request for curl.

Re-run the authentication request from the collection:

code-generation

Then click on the 'Code' icon in the right sidebar:

code-generation icon

This pops up the Code snippet sidebar. curl should be selected by default; if not, then use the dropdown menu to select curl:

select-curl

Now we can see the set of curl commands that matches this Postman request:

curl-code

Let's authenticate again, by running the generated curl commands in a terminal:

curl-in-terminal

As you can see, we can make an equivalent request in curl.

This is valuable for bash scripts, where we can store the values of the tokens in variables. However, Postman does this automatically, which makes it a convenient tool with which to investigate APIs.

Computer monitors with fiskaly newsletter subscription page on them

Stay up to date

Subscribe to our dev newsletter and be the first to learn about new updates, features, products and news!

*By submitting the form, I consent to fiskaly processing my information in accordance with the fiskaly Privacy Policy.Privacy Policy