Forums

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

Automation not able to deal with date format returned by REST api 2026-12-03T17:10:31Z

Peter Nixon
December 10, 2025

Hi,

I am using the below api query to get our api tokens and their expiry date for a service userr.

API query: GET https://api.atlassian.com/admin/api-access/v1/orgs/<orgid>/service-accounts/<service accountid>/api-tokens

The expiresAt value which is returned has this format "expiresAt": "2026-12-03T17:10:31Z". Jira automation can't seem to handle it. When I add .jqlDate or .format("yyyy-MM-dd") to the smart value, it returns a blank value.

Any ideas how I can convert this to a useable value? And why Jira would be returning an un-useable format in the first place?

 

1 answer

1 vote
Sam Okell
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 Champions.
December 10, 2025

Hi @Peter Nixon 

 

I've come across this before when trying to re-use data given through the REST API, and the workaround we've found works is to firstly store the data within a variable and then use that variable going forward.

 

For example.

1. REST API produces your response.

2. Add variable called responseDate with {{webResponse.body.expiresAt}} (update this to whatever you have found is currently working, dependant on the response format).

3. You can then use the variable as {{reponseDate.format("yyyy-MM-dd")}}

 

Hopefully that works for you!

Peter Nixon
December 10, 2025

Thanks for your quick response, unfortuanately still getting the same issue.

I've added the variable to the branch as there are multiple tokens it is going through. The variable is returning the value fine, but again, as soon as I try to convert it, it is becomes a blank value.

Screenshot 2025-12-10 102402.png

Calvin
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 Champions.
December 10, 2025

Just wanted to echo, ran into something similar and had to do a similar workaround also by placing the value into a variable first before changing it.

Sam Okell
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 Champions.
December 10, 2025

Here you go, this should work better:

{{responseDate.replace("+0000", "+00:00").toDate.format("yyyy-MM-dd")}}

 

Having a search around, looks like the +0000 isn't ideal format and so doesn't work, replacing this with +00:00 works properly, then the .toDate converts it properly to a date, which you can then format from.

 

Hopefully that now works!

Peter Nixon
December 10, 2025

I didn't get that to work but I stole your idea and got the below to work!

{{item.expiresAt.replace("Z", ".0+0000").toDate.jqlDate}}

Where item = webResponse.body

Thanks for your help! Very annoying that it is all atlassian data but it can't deal with the date format.

Like Sam Okell likes this
Sam Okell
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 Champions.
December 10, 2025

@Peter Nixon 

Perfect! I'd used a slightly different API endpoint (we don't use Service Accounts yet!) and so the format came out differently again!!

 

Either way, glad you got it working :)

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events