REST API Time/Date formats

I'm trying to set a time value via REST and I can't get the right format.

I've tried:

2012/03/30

2012-03-30

30-MAR-2012

and many others... but none of them seem to work correctly. I keep getting a bad HTTP response. when I look at the value in the issue it looks like I should be able to put:

{fields=>{customfield_12345 => "2012-03-31"}} every time.

3 answers

1 accepted

This widget could not be displayed.

Hi! It's a Date Picker field type. The format is 02/Jun/12, which I've tried.

I could switch to a DateTime field type, but don't those have 'pickers' too?

Hi Tom!

Sorry for the late response here. I have tried to insert some date into Date Picker custom field, and I am also getting the same exceptions when running the following cURL REST request:

curl -u admin:admin -X PUT --data '{"fields" : {"customfield_10000":"2012-06-02"}}' -H "Content-Type: application/json" http://5.125.147.3:8085/jira/rest/api/2/issue/TP-3

However, I've tried to get the issue JSON data using the GET method, and I noticed that the date format for the custom field is rendered as 2012-06-02 instead.

Hence, the following REST request should work:

curl -u admin:admin -X PUT --data '{"fields" : {"customfield_10000":"2012-06-02"}}' -H "Content-Type: application/json" http://5.125.147.3:8085/jira/rest/api/2/issue/TP-3

Hope that the info helps!

This widget could not be displayed.
Hi Tom, May I know what is the custom field type that we are trying to inject the value to using REST? And furthermore, you may kindly try to check the date time format configuration in the look and feel, and perhaps use the same format as configured and see if it helps?
This widget could not be displayed.

Not sure what changed, but it's working now...

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 8 hours ago 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...

21 views 0 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