Unable to create JIRA macro using CLI

Hello,

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.

Adam

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.

Adam

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.

Adam

Hi,

Thks a lot Adam and Bob

Jb

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Friday in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

309 views 11 10
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