I'm trying to make a script to constantly query Jira (using cron) for tickets with its custom field (containing some time information about the ticket) defined as the current time. I have the lines below in my script but it seems like JQL doesn't accept variables:
starttime=$(date +"%H:%M")
(curl \
-u username:password \
-X POST \
-H "Content-Type: application/json" \
--data '{"jql":"project = ZZZ and cf[99999] = \"$starttime\"","startAt":0,"maxResults":5,"fields":["customfield_99999","key"]}' \
"https://jira.url.com/rest/api/2/search"
) | python -m json.tool > /home/tickets.txt
The query works if the custom field value is defined but when using a variable it doesn't. Is it because of my syntax or does JQL not support this kind of query? I read the documentation and as of now I haven't found anything regarding using variables.
Thanks!