Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How can I change the versions of an project with the Jira REST API

Ed Schrauwers July 19, 2018

I can't find documentation on how to change the versions of an project when using the Atlassian Jira REST Api.

1 answer

1 accepted

0 votes
Answer accepted
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 19, 2018

Hello,

Do you need to assign a version to an issue or change version's attribute like name and release data?

Ed Schrauwers July 20, 2018

No, I want to change the version of a project. When I manualy create an project I can add versions to the project. Now I want to create projects with the Jira REST API and I need to add, some times remove, version information to and from those projects.
When I read a added project with the Jira REST API I see no versions, '"versions":[],', how can I manipulate the versions assigned to a project.

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 20, 2018
Ed Schrauwers July 20, 2018

Thank you for your fast reply, I will have a look at this.

Ed Schrauwers July 20, 2018

Tou pointed me in the right direction, thank you for that. Now I have a problem that when I want to add a version to a project I get an Bad Requist error 400.

The data I send is exactly as in the example:
{
 "description": "5.0.1813.05",
 "name": "5.0.1813.05",
 "archived": false,
 "released": false,
 "releaseDate": "2018-07-30",
 "userReleaseDate": "30/jul/2018",
 "project": "FLXI",
 "projectid": 10000
}

The project exists, it's the right project id, I use POST mode, the url is correct, and the content type is set, the content length is set and the json string abouve is send to the web request stream. I am missing something but I don't know what.

Ed Schrauwers July 20, 2018

And because I use HTTP I also filled httpWebRequest.UserAgent = ".NET Framework Client"; 

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 20, 2018

Could you provide the response json? When you make a request, besides the error you also get a json back. 

Ed Schrauwers July 23, 2018

Thanks for your time. I use  c# and the RestSharp assembly to communicate, in the exception I get I do not see any json, what I do see when I catch the exception is a response part in the details.
In that response part I see a content type "application/json;charset=UTF8", the method used "PUT", the status code "BadRequest" and a status "ProtocolError".
I send the request as an ansi string, do I need to send this request UTF8 encoded? (I already tried but that failed in a quick test)

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 23, 2018

I am not sure about c#. You can take Postman or Soap UI and try to execute there. if it works, then the problem is with your code.

Ed Schrauwers July 23, 2018

Ok, thanks for your time, I will test this in a few minutes.

Ed Schrauwers July 24, 2018

The problem is solved. 3 'errors' in my json.

projectid should be projectId, it is not allowed to provide releaseDate and userReleaseDate and it is not allowed to provide project and projectId.

{
  "description": "5.0.1813.05",
  "name": "5.0.1813.05",
  "archived": false,
  "released": false,
  "releaseDate": "2018-08-03",
  "project": "FLXI"
}

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events