Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

REST API Time/Date formats

Tom Allison
Contributor
September 1, 2012

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
Answer accepted
Tom Allison
Contributor
September 1, 2012

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?

Faisal
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.
September 2, 2012

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!

0 votes
Tom Allison
Contributor
September 4, 2012

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

0 votes
Faisal
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.
September 1, 2012
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?

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, loom, loom for training, loom for teaching, video training, async learning, online education, screen recording, loom tutorials, loom use cases, atlassian learning, team training tools, instructional video, virtual training tools

🛗 Elevate Your Training and Enablement with Loom

Join us June 26, 11am PT for a webinar with Atlassian Champion Robert Hean & Loom’s Brittany Soinski. Hear tips, stories, and get your burning questions answered. Learn how Loom makes training and enablement easier. Don’t miss it!

Register today
AUG Leaders

Atlassian Community Events