本文介绍了如何将Confluence宏插入由Confluence Rest Api创建的页面中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经成功地使用Confluence Rest API创建了一个页面并将其附加到Space.我的json从示例中看起来很像:

I've successfully used the Confluence Rest API to create a page and attach it to a Space. MY json looks much like that from the example:

{
"type":"page","title":"My Example Page 1", "space": {"key":"DAT"},
"body":{"storage":{"value":"<p>This is a new page</p>","representation":"storage"}}
}

如果我在Confluence中以交互方式创建页面,则在单​​击附件"或活动流"之类的编辑"按钮时,会得到一个固定宏的列表.

If I create a page interactively in Confluence, I'm given a list of canned macros when I click the 'Edit' button like 'Attachments' or 'Activity Stream'.

使用附件宏"作为正文而不是这是新页面"来创建页面的正确json值是什么?

What is the right json value to create a page with the Attachments Macro as the body instead of 'This is a new page'?

类似于以下内容(完全构成):

Something like below (which is totally made up):

{
"type":"page","title":"My Example Page 1", "space": {"key":"DAT"},
"body":{"storage":{"value":"**Attachments_Macro_Block**","representation":"storage"}}
}

我要用什么代替json中的"Attachments_Macro_Block",以得到显示宏块的结果页面?

What would I substitute for 'Attachments_Macro_Block' in the json to get the resultant page to display the macro block?

推荐答案

很幸运,在我发布此问题后,我迷失了答案.因此,为了他人的利益,这就是我所发现的.

As luck would have it, after I posted this question I stumbled on the answer. So for the benefit of others, here is what I found.

此页面提供了缺少的内容: Confluence附件宏帮助

This page provided the missing pieces: Confluence Attachment Macro Help

我的JSON看起来像这样:

My JSON looked like this:

{
"type":"page",
"ancestors":
    [
        {
            "type":"page",
            "id":12355342
        }
    ],
"title":"Page Title 1",
"space":
    {
        "key":"DAT"
    },
"body":
    {
        "storage":
            {
                "value":"<ac:structured-macro ac:name=\"attachments\">
                <ac:parameter ac:name=\"old\">false<\/ac:parameter> <ac:parameter ac:name=\"patterns\">*<\/ac:parameter>
                <ac:parameter ac:name=\"sortBy\">name<\/ac:parameter> <ac:parameter ac:name=\"sortOrder\">ascending<\/ac:parameter>
                <ac:parameter ac:name=\"labels\"><\/ac:parameter> <ac:parameter ac:name=\"upload\">false<\/ac:parameter> <\/ac:structured-macro>",
                "representation":"storage"
            }
    }
}

这篇关于如何将Confluence宏插入由Confluence Rest Api创建的页面中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 20:42