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

This widget could not be displayed.

I have the same problem.


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

This widget could not be displayed.
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
This widget could not be displayed.

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
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

139 views 2 0
Join discussion

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