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?
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!
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.