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

Christian Schlaefcke
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.
January 22, 2013

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

1 vote
Steve Shi May 3, 2013

I have the same problem.


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

0 votes
benjamin k March 16, 2015

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;

 

 

0 votes
AgentSmith
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 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

Suggest an answer

Log in or Sign up to answer