CircleCI-Archived / api-preview-docs

In-progress docs about the pre-release preview of CircleCI API v2
72 stars 39 forks source link

Passing environment variables in API v2? #58

Open glebsonik opened 4 years ago

glebsonik commented 4 years ago

Is it possible to pass environment variables in JSON body of API v2 call?

Even with pipelines parameters, I want to use environment variables, so I tried to make api v2 call

https://circleci.com/api/v2/project/:vcs-type/:username/:project/pipeline

and tried something like this to send in body:

{
    "branch": "circle_ci_api_v2_test",
    "parameters": 
    {
          "my_mystical_param": "Hello from postman mystic",
          "my_legendary_param": "Hello from postman legendary"
    },
    "build_parameters":{
      "envVar": "kuku iopta",
          "testVar1": 27
    }
}

But circle ci build does not see any variables. Is there any way to pass them? Beacuse, I think that making assignment env_var_name=parameter_name is not good idea.