Passing variables when starting pipelines from api?

I’m trying to start a pipeline with a variable but I’m not having much luck with the syntax. Could someone please point me in a more useful direction?

curl -s -X POST -F ref=master -F “variables[GITLAB_JOB]=top-of-tree” -H “Authorization: Bearer mumble” “https://mumble.net/api/v4/projects/603/pipeline

returns:

{“message”:“500 Internal Server Error”}

Looks like a long standing known problem.

Hi @agapanthusblue
as mentioned in a comment in the issue you have found and in the docs variables can be passed as part of the URL string.
"https://gitlab.example.com/api/v4/projects/169/pipeline?ref=master&variables[][key]=VAR1&variables[][value]=hello&variables[][key]=VAR2&variables[][value]=world"
Give it a try :slight_smile:

2 Likes

I wasn’t able to make that work with POST pipeline, but I was with POST trigger/pipeline. This was also mentioned in the linked thread.

Afaict, the only difference between the two calls is that one can accept variables and the other cannot. But I only need one, so I’m good for now.

Thank you, worked for me with pipeline api call as well