How to set a custom field value of type "Tempo Account" with REST API

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

3 answers

I have the same problem.


I can set other fields, like assignee but not custom fields. saw the same error message.

0 vote
Jason Worley Atlassian Team Jan 20, 2015

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

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 
&lt;USERNAME&gt;:&lt;PASSWORD&gt; -X PUT --data '{ "fields": { 
"customfield_11531":&lt;ACCOUNT-ID&gt;}}' http://127.0.0.1:8080/rest/api/2/issue/&lt;PROJECTKEY&gt;-&lt;ISSUENUM&gt;

 

 

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Jira

Mission-critical battery manufacturer fulfills FAA software requirements with Commit Policy Plugin

EaglePicher Technologies is a leading manufacturer of battery systems for diverse industries like defense, aviation, space or medical. As they operate in highly regulated industries, keeping a clear ...

127 views 0 2
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you