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 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 Thursday 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 ...

178 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