[JIRA] (JENKINS-53869) Starting a job using the API returns 302 instead of 201

4 views
Skip to first unread message

jnazander1@gmail.com (JIRA)

unread,
Oct 2, 2018, 3:24:02 AM10/2/18
to jenkinsc...@googlegroups.com
Jevgeni Nazander created an issue
 
Jenkins / Bug JENKINS-53869
Starting a job using the API returns 302 instead of 201
Issue Type: Bug Bug
Assignee: Unassigned
Attachments: 302.png
Components: core
Created: 2018-10-02 07:23
Environment: Jenkins: 2.138.1
OS: Ubuntu 16.04.5 LTS
Labels: API rest
Priority: Minor Minor
Reporter: Jevgeni Nazander

Any time a job is started using the `/build` or `/buildWithParameters` URL (either via the job's page itself or via an API call), it always returns a `HTTP 302` response that redirects to the job's page, instead of the correct HTTP 201.

This behavior contradicts the API documentation itself, which states:

To programmatically schedule a new build, post to this URL (/build). If the build has parameters, post to this URL (/buildWithParameters) and provide the parameters as form data. Either way, the successful queueing will result in 201 status code with Location HTTP header pointing the URL of the item in the queue.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

jnazander1@gmail.com (JIRA)

unread,
Oct 2, 2018, 3:25:01 AM10/2/18
to jenkinsc...@googlegroups.com
Jevgeni Nazander updated an issue
Change By: Jevgeni Nazander
Any time a job is started using the `/build` or `/buildWithParameters` URL (either via the job's page itself or via an API call), it always returns a `HTTP 302` response that redirects to the job's page, instead of the correct HTTP 201.

This behavior contradicts the API documentation itself, which states:

_To programmatically schedule a new build, post to  [ this URL |https://jenkins.brghtr.net/job/benefitloop/job/accounts/build]  (/build). If the build has parameters, post to  [ this URL |https://jenkins.brghtr.net/job/benefitloop/job/accounts/buildWithParameters]  (/buildWithParameters) and provide the parameters as form data. Either way, the successful queueing will result in *201 status code* with {{Location}} HTTP header pointing the URL of the item in the queue._

esteban.marin@bithost.ch (JIRA)

unread,
Feb 15, 2019, 6:46:02 AM2/15/19
to jenkinsc...@googlegroups.com
Esteban Marin commented on Bug JENKINS-53869
 
Re: Starting a job using the API returns 302 instead of 201

This seems to happen when building a "Pipeline" build. For normal builds, this does not occur.

marcosrivas17@gmail.com (JIRA)

unread,
Mar 31, 2020, 2:38:04 AM3/31/20
to jenkinsc...@googlegroups.com
Marcos Rivas updated an issue
 
Change By: Marcos Rivas
Priority: Minor Major
This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo

marcosrivas17@gmail.com (JIRA)

unread,
Mar 31, 2020, 2:38:05 AM3/31/20
to jenkinsc...@googlegroups.com
Marcos Rivas commented on Bug JENKINS-53869
 
Re: Starting a job using the API returns 302 instead of 201

I can confirm this is an issue, there is no possible way to obtain the build number of a pipeline job that has been launched by calling /build or /buildWithParameters endpoint

Reply all
Reply to author
Forward
0 new messages