Hi,
I found this useful Link: https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API+Example+-+Create+Issue explaining in general how to add values for custom fields using the REST API. It works well for "normal" custom fields.
I have a problem when I want to set the value for a custom field of type "Tempo Account". The field is available on the desired screen and gets displayed as a dropdown select list. So I guessed that I can set the value with a JSON like this:
{"fields":{"summary":"Some Summary","project":{"id":"10140"},"issuetype":{"id":"11"},"priority":{"id":"3"},"customfield_10130":[{"value":"Some Value 1"},{"value":"Some Value 2"},{"value":"Some Value 3"},{"value":"Some Value 4"}],"parent":{"id":"45561"},"fixVersions":[{"released":"false","archived":"false","description":"Update 12.02.2013","name":"Some Version","self":"http://my.url/rest/api/latest/version/12267"}],"customfield_10242":{"value":"970155"}}}
Where customfield_10242 is the field of type "Tempo Account".
When I submit this request to JIRA I get the following error:
{"customfield_10242":"Operation value must be a string"}
Next guess was to change the JSON as follows:
{"fields":{"summary":"Some Summary","project":{"id":"10140"},"issuetype":{"id":"11"},"priority":{"id":"3"},"customfield_10130":[{"value":"Some Value 1"},{"value":"Some Value 2"},{"value":"Some Value 3"},{"value":"Some Value 4"}],"parent":{"id":"45561"},"fixVersions":[{"released":"false","archived":"false","description":"Update 12.02.2013","name":"Some Version","self":"http://my.url/rest/api/latest/version/12267"}],"customfield_10242":"970155"}}
Using this I do not get an error but the issue will be created without filling the value for the custom field.
Thank you for any hint that points me to the right direction!
Regards,
Christian
I have the same problem.
I can set other fields, like assignee but not custom fields. saw the same error message.
I had the same problem. Couldn't get the REST API to assign issues to tempo accounts.
This didn't work for me
curl -D- -u <USERNAME>:<PASSWORD> -X PUT -H "Content-Type: application/json" --data '{"update":{"customfield_11531":[{"set":"SOME-ACCOUNT-KEY-OR-ID"}] } }' https://hostname/rest/api/2/issue/WWP-2
I tried a lot of different variations but I always got "Operation value must be a number".
Figured out that the "Operation value" has to be the tempo account id.
Finally this worked for me.
Get all tempo accounts and their IDs:
curl -s -H "Content-Type: application/json" -u <USERNAME>:<PASSWORD> -k "http://127.0.0.1:8080/rest/tempo-accounts/1/account" | sed 's/},{/},\n{/g' | awk -F '[:"",]' {'print $4";"$9'}
Output:
<ACCOUNT-ID>;<ACCOUNT-KEY> 111;SOME-ACCOUNT-KEY 222;SOME-ACCOUNT-KEY
customfield_11531 is the name of my tempo account field.
Get yours:
http://<YOUR-JIRA-SERVER>/rest/api/2/issue/{issueIdOrKey}/editmeta
Search for "com.tempoplugin.tempo-accounts:accounts.customfield"
curl -D- -H 'Content-Type: application/json' -u <USERNAME>:<PASSWORD> -X PUT --data '{ "fields": { "customfield_11531":<ACCOUNT-ID>}}' http://127.0.0.1:8080/rest/api/2/issue/<PROJECTKEY>-<ISSUENUM>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Update a custom field with PUT
curl -D- -u admin:admin -X PUT -H "Content-Type: application/json" --data '{"update":{"customfield_10031":[{"set":"2015-01-18"}] } }' https://hostname/rest/api/2/issue/WWP-2
Check the Results with GET
curl -D- -u admin:admin -X GET -H "Content-Type: application/json" https://hostname/rest/api/2/issue/WWP-2?fields=customfield_10031
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.