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

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!

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?

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

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,308 views 14 20
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot