Unable to create JIRA macro using CLI

Peter Drill May 16, 2013

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

0 votes
Answer accepted
Bob Swift OSS (Bob Swift Atlassian Apps)
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 Leaders.
May 16, 2013

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.

Peter Drill May 20, 2013

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

Bob Swift OSS (Bob Swift Atlassian Apps)
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 Leaders.
May 20, 2013

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

Peter Drill May 22, 2013

Hi Bob,

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

Adam

0 votes
jean-baptiste guillot February 24, 2014

Hi,

Thks a lot Adam and Bob

Jb

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events