# How to send variables from Jenkins so that the Postman environment can take them?

**URL:** <https://community.postman.com/t/how-to-send-variables-from-jenkins-so-that-the-postman-environment-can-take-them/17739>\
**Category:** Help Hub\
**Tags:** newman-project, json, jenkins, continous-integratio\
**Created:** [November 16, 2020, 5:13pm UTC](https://community.postman.com/t/how-to-send-variables-from-jenkins-so-that-the-postman-environment-can-take-them/17739 "2020-11-16T17:13:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dpicado009](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/dpicado009/32/5629_2.png) [@dpicado009](https://community.postman.com/u/dpicado009)\
**Post date:** [November 16, 2020, 5:13pm UTC](https://community.postman.com/t/how-to-send-variables-from-jenkins-so-that-the-postman-environment-can-take-them/17739/1 "2020-11-16T17:13:14Z")

</div>

> **Archived topic — this may be out of date.**  
> Newman has been replaced by the **[Postman CLI](https://learning.postman.com/docs/postman-cli/postman-cli-overview/)**, Postman’s official, signed command-line tool. It runs collections as Newman did, and also lints API specs, runs mocks and monitors, and syncs local files with Postman from your terminal, CI/CD pipeline or coding agent.  
> Working with an AI coding agent? The [Postman plugin](https://github.com/postmanlabs/postman-plugin) lets agents in Claude Code, Cursor, Codex and others design, mock, test and ship APIs with Postman.  
> For current help, see the [Postman docs](https://learning.postman.com/docs/), try the free [Postman tools](https://www.postman.com/tools) (no account needed), or join us on [Discord](https://discord.gg/58aNNsRBGR).

Currently I have an environment variable called URL, where I add the url that I need to use for each EndPoint that I have, however, I would like to know if it is possible to change this environment variable from Jenkins to indicate another url, for example wanting to work in environments already be it QA, DEV, Production, etc. If this is possible, how can I send that information to my collection (json) of environment variables?

This is my current JenkinsFile

```auto
pipeline {
    agent any

    stages {
        stage('Running tests') {
            steps {
                echo 'Testing'
                sh "newman run postman_collection.json -e .postman_environment.json"
            }
        }
    }
}

```

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [November 16, 2020, 5:25pm UTC](https://community.postman.com/t/how-to-send-variables-from-jenkins-so-that-the-postman-environment-can-take-them/17739/2 "2020-11-16T17:25:09Z")

</div>

Hey @dpicado009

Welcome to the Community! 🚀

You could use either `--global-var` or `--env-var` to pass data from Jenkins into the Collection.

If the `{{foo}}` global variable were used in the Collection, it would resolve it to the `bar` value.

```auto
--global-var "foo=bar"

```

For your Jenkins example, you would need something like this:

```auto
pipeline {
    agent any

    stages {
        stage('Running tests') {
            steps {
                echo 'Testing'
                sh "newman run postman_collection.json -e .postman_environment.json --env-var 'variableName=$JENKINS_VARIABLE'"
            }
        }
    }
}

```

---

<div class="post-metadata">

**Author:** ![dpicado009](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/dpicado009/32/5629_2.png) [@dpicado009](https://community.postman.com/u/dpicado009)\
**Post date:** [November 16, 2020, 7:10pm UTC](https://community.postman.com/t/how-to-send-variables-from-jenkins-so-that-the-postman-environment-can-take-them/17739/3 "2020-11-16T19:10:12Z")

</div>

You do not know how much I appreciate it, I could do it, just as you told me…  
 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/7/3/73a6767bd1e6aab4601372234d1dd2e4bd168b64.png)

 ![image_2020_11_16T19_06_24_003Z](https://us1.discourse-cdn.com/getpostman/original/3X/5/5/55f5d6afd2e480fbf80c6a061d1d715985283167.png)

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [November 16, 2020, 7:14pm UTC](https://community.postman.com/t/how-to-send-variables-from-jenkins-so-that-the-postman-environment-can-take-them/17739/4 "2020-11-16T19:14:30Z")

</div>

Did that work for you?

It’s hard to tell from the images. 😁

---

<div class="post-metadata">

**Author:** ![dpicado009](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/dpicado009/32/5629_2.png) [@dpicado009](https://community.postman.com/u/dpicado009)\
**Post date:** [November 16, 2020, 7:25pm UTC](https://community.postman.com/t/how-to-send-variables-from-jenkins-so-that-the-postman-environment-can-take-them/17739/5 "2020-11-16T19:25:48Z")

</div>

For what I need yes, is that the images I had to edit because they are names of the work collections and for safety, I put them like this.

---

<div class="post-metadata">

**Author:** ![poornapragnaps](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/poornapragnaps/32/7529_2.png) [@poornapragnaps](https://community.postman.com/u/poornapragnaps)\
**Post date:** [April 16, 2021, 6:31pm UTC](https://community.postman.com/t/how-to-send-variables-from-jenkins-so-that-the-postman-environment-can-take-them/17739/6 "2021-04-16T18:31:40Z")

</div>

Hi Team, @danny-dainton,

Could you pls help me – how to pass the ’ Environmental Variables’ and ‘Global Variables’ from Jenkins using postman(newman) – Execute Windows batch command
