Hi ,
I would like to execute the below GitLab API But I am not able to get the “:job_id”.
Please help me to from where we can get the job_id using gitlab API.
For Example .
I need to execute the below API but I don’t know how to get the job_id using gitlab API.
Play a job
Triggers a manual action to start a job.
POST /projects/:id/jobs/:job_id/play
Anyone can suggest me for the same.
Thanks ,
Kiran.
trizzi
#2
You have a few options. You could look at all of the jobs in a given project with:
GET /projects/:id/jobs
Or a specific pipeline’s jobs with
GET /projects/:id/pipelines/:pipeline_id/jobs
Here is the documentation for the jobs API. Hope this helps!
Hi @trizzi,
I have use below code for getting the job_id and I got the below Error
curl: (22) The requested URL returned error: 400 Bad Request
function Play_a_job(){
local job_id=$(curl $url"projects/$project_id/jobs?private_token=$token" | jq .[0].id)
exec_api $curl_post_param "$token_param" $url"projects/$project_id/jobs/$job_id/play"
}
curl: (22) The requested URL returned error: 400 Bad Request
@trizzi ,
Please correct me If anything is wrong into the code.