Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to define the open-api marco in confluence markdown?

Linton Galloway
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 21, 2019

I'm trying to generate my pages programmatically as part of an automated CI release task.

Does anyone have an example of how to define the open-api macro, from the confluence marketplace, using confluence markdown?

2 answers

1 vote
Scott
Contributor
November 10, 2019

It is not clear whether you are using Confluence Cloud or Confluence Server, but the relevant REST API documentation for each platform can be found here:

https://developer.atlassian.com/server/confluence/confluence-server-rest-api/

https://developer.atlassian.com/cloud/confluence/rest/

In either case, there is a REST endpoint that you can call to create a page with content, e.g. https://developer.atlassian.com/server/confluence/confluence-rest-api-examples/

In this API request body, the `body.storage.value` is where you specify the content for the page being created.

If you open an existing Confluence page that contains the Open API macro, and choose "View Storage Format" from the context menu, you should see that the storage format for the macro looks something like this:

<ac:structured-macro ac:name="open-api">
<ac:parameter ac:name="url"> ** your url goes here ** </ac:parameter>
  <ac:plain-text-body><![CDATA[ ]]></ac:plain-text-body>
</ac:structured-macro>

In theory, you should be able to pass something like the above as the `body.storage.value` of the REST API call, to create a page with an Open API macro for your URL in it.

Hope this helps. Good luck!

AriamAb
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 10, 2019

@Scott Passing that storage format as the `body.storage.value` worked for me!

0 votes
AriamAb
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 10, 2019

@Linton Galloway Have you ever figured out how to specify marco when creating pages programmatically? 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events