Unable to create JIRA macro using CLI


I am using atlassian-cli 3.4.0 to automate a number of functions after a new build is completed. One of these is to create a new blog entry on Confluence that shows the JIRA issues fixed in the latest version.

If I manually create a blog post that contains a JIRA macro with the appropriate JQL everything works fine, however if I try it using the CLI (command below), I get the error message - Unknown macro: "jira"

C:\Tools\atlassian-cli-3.4.0\confluence.bat --server https://readysell.atlassian.net/wiki --user adam --password MYPASSWORD --action addNews --space "RSELL" --title "Release Notes - 8.15.30517.Alpha" --content "<p><ac:macro ac:name=&quot;jira&quot;><ac:parameter ac:name=&quot;server&quot;>JIRA (readysell.atlassian.net)</ac:parameter><ac:parameter ac:name=&quot;serverId&quot;>ae02c637-0cfd-33d8-a56c-e4b0dc086094</ac:parameter><ac:parameter ac:name=&quot;jqlQuery&quot;><![CDATA[Project = &quot;RSELL&quot; AND FixVersion = &quot;8.15.30517.Alpha&quot;]]></ac:parameter></ac:macro></p>" --noConvert --labels "release-notes-alpha"

Any assistance would be appreciated.


2 answers

1 accepted

Wiki syntax reads easier :), but you can use xhtml as well, just use " instead of &quot;. Use single quotes around the content to avoid escaping the embedded double quotes or just escape them.

Hi Bob,

I have tried it using single quotes and unescaped double quotes as follows:

confluence.bat --server https://readysell.atlassian.net/wiki --user adam --password MYPASSWORD --action addNews --space "RSELL" --title "Release Notes - 8.15.30517.Alpha" --content '<p><ac:macro ac:name="jira"><ac:parameter ac:name="server">JIRA (readysell.atlassian.net)</ac:parameter><ac:parameter ac:name="serverId">ae02c637-0cfd-33d8-a56c-e4b0dc086094</ac:parameter><ac:parameter ac:name="jqlQuery"><![CDATA[Project = "RSELL" AND FixVersion = "8.15.30517.Alpha"]]></ac:parameter></ac:macro></p>' --noConvert --labels "release-notes-alpha"

Now, when I execute this I get this error message:

< was unexpected at this time.

And nothing is posted.


Sorry for the confusion, that syntax works on Linux/Mac but not Windows. I had to get my Windows system started to verify. Here is the Windows syntax for escaping this kind of text that will get the action running, although I am unsure about your xhtml macro stuff.

atlassian confluence-4.3.0 --title "Release Notes - 8.15.30517.Alpha" --content "<p><ac:macro ac:name=\"jiraissues\"><ac:para
meter ac:name=\"server\">JIRA (readysell.atlassian.net)</ac:parameter><ac:parameter ac:name=\"serverId\">ae02c637-0cfd-33d8-a56c-e4b0dc086094</ac:parameter><ac:parameter ac
:name=\"jqlQuery\"><![CDATA[Project = \"RSELL\" AND FixVersion = \"8.15.30517.Alpha\"]]></ac:parameter></ac:macro></p>" --noConvert --labels "release-notes-alpha" --action addNews --space experiment
Blog created: http://xxxx:118/display/EXPERIMENT/2013/05/21/Release+Notes+-+8.15.30517.Alpha with labels: release-notes-alpha. Blog has id: 78938120

Hi Bob,

Thanks, that did it! Escaping the quotes with a backslash rather than using &quot; fixed the macro.



Thks a lot Adam and Bob


Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Feb 06, 2019 in Confluence

Try out the new editing experience

Hi team, I’m Avinoam, a product manager on Confluence Cloud, and today I’m really excited to let the Community know that all customers can now try out the new editing experience and see some of the ...

888 views 45 7
Join discussion

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