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

0 votes
Accepted answer

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
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,099 views 4 9
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