I want to use JIRA Cloud REST API put fixversion to many issues.
I read JIRA Cloud REST API doc and used code litke this
curl -X PUT --data "{ \"update\": { \"fixVersion\": [ { \"add\": \"0.0.3\" } ] } }" https://$USERNAEM:$PASSWORD@$net/rest/api/2/issue/$issueid
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 54 0 0 100 54 0 52 0:00:01 0:00:01 --:--:-- 53
but nothing happened
I get info form /{issueIdOrKey}/editmeta
"fixVersions": {
"required": false,
"schema": {
"type": "array",
"items": "version",
"system": "fixVersions"
},
"name": "Fix Version\/s",
"key": "fixVersions",
"operations": [
"set",
"add",
"remove"
],
"allowedValues": [
{
"self": "https:\/\/eastek-ezcam.atlassian.net\/rest\/api\/2\/version\/18300",
"id": "18300",
"name": "0.0.0",
"archived": false,
"released": false,
"projectId": 11000
},
{
"self": "https:\/\/eastek-ezcam.atlassian.net\/rest\/api\/2\/version\/18301",
"id": "18301",
"name": "0.0.1",
"archived": false,
"released": false,
"projectId": 11000
}
]
},
Is '"required": false' the reason I failed ?
How do I let "required": true ?
-------------------------------Update(8/28)------------------------------
I added '-H "Content-Type: application/json"'
#!/bin/sh
curl -u $USERNAEM:$PASSWORD -X PUT -H "Content-Type: application/json" --data '{"update": {"fixVersions": [{"add": [{ "name": "0.0.2"}]}]}}' $URL
and got error message
{"errorMessages":[],"errors":{"fixVersions":"Could not find valid 'id' or 'name' in version object."}}
Looks to me like your curl command is wrong, not the data. Try using it as documented, with -u for username and password, and the url as a distinct item.
Also, what errors are you getting? "Nothing happened" does not tell us anything.
Thank for your help.
I said "Nothing happened" because it didn't gave me any errors likes "http error code" or "crul error".
I use
curl -u $USERNAEM:$PASSWORD -X PUT --data "{ \"update\": { \"fixVersion\": [ { \"add\": \"0.0.3\" } ] } }" https://$net/rest/api/2/issue/$issueid
and get only this.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 54 0 0 100 54 0 50 0:00:01 0:00:01 --:--:-- 51
It still failde for me putting fixversion to my issue. :(
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If it's getting nothing back at all, that is very odd. We can see it's not.
Can you visit that url in a browser? Does that give you any response at all?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes. I can visit url in a browser.
I also can use api to get infomation from the same url.
Is the reason that I'm not the owner of JIRA?
I'm one of the team members.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If the url you intend to reach gives you data, but your curl does not, then there's something wrong in the curl invocation.
My guess is that your code is not expanding the $net and/or $issueid variables in the way you expect.
You have not given the context of where that line is running. Maybe show us the script it is in?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My test scritp
#!/bin/sh
# -*- coding: utf-8 -*-
#Usage: ./add_version.sh fixversion
USERNAEM=''
PASSWORD=''
team=''
version=$1
jira_keys=`cat jira_keys`
for KEY in $jira_keys
do
curl -X PUT --data "{ \"update\": { \"fixVersion\": [ { \"add\": \"$version\" } ] } }" https://$USERNAEM:$PASSWORD@$team.atlassian.net/rest/api/2/issue/$jira_keys
done
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I update the error message on my post.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.