Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Create a confluence page having the JIRA macro or JIRA filter. Edited

Hi Team,

 

I am able to create the blank page in confluence using rest api.

If I try to create a page having JIRA macro I am not getting succeeded .

Below is the snippet for creating a page.

createPage = "{\"type\":\"page\",\"title\":\"new page\",\"space\":{\"key\":\"OMS\"},"

+ "\"body\":{\"storage\":{\"value\":\"\"<h2>Display the Sprint -Sprint 5 which is closed issues.</h2><p />"

+ "\"<ac:structured-macro ac:name=\\\"jira\\\" ac:schema-version=\\\"1\\\" data-layout=\\\"full-width\\\" ac:macro-id=\\\"dads2-6csdff-dsd-r6ff-6dfgdb232\\\">"

+ "\"<ac:parameter ac:name=\\\"server\\\">System JIRA</ac:parameter><ac:parameter ac:name=\\\"maximumIssues\\\">20</ac:parameter>"

+ "\"<ac:parameter ac:name=\\\"columns\\\">key,summary,type,created,assignee,reporter,priority,status,resolution</ac:parameter>"

+ "\"<ac:parameter ac:name=\\\"jqlQuery\\\">Sprint =  &quot;OMS Sprint 5&quot;  and status=close and project = OMS </ac:parameter>"

+ "\"<ac:parameter ac:name=\\\"serverId\\\">3f701a8d-470a-3309-8926-3b7be06fa653</ac:parameter></ac:structured-macro><p />"

+ "\",\"representation\":\"storage\"}}}";

 

Please any one can help me on this.

2 answers

Hi! I'm not sure about the snippet part, but you could always try creating a template with the Jira macro, so every time you create a page from that template the jira macro will be added. Hope this helps :)

Hi,

is there any api's are available for creating a template instead of page in confluence?

0 votes
Davin Studer Community Leader Dec 12, 2019

My hunch is there is something off in the raw post. Probably something is not escaped properly. I would first mock it up in Confluence and get the storage format for the page. Then run that storage format through a tool to escape out the string for JSON such as below ...

https://www.freeformatter.com/json-escape.html

https://codebeautify.org/json-escape-unescape

Then craft your JSON using the escaped string. Next, you will need to escape the JSON to work within a string. So take that JSON with the escaped storage format and escape that whole thing out again. Not sure what language you are using but here is one for JavaScript.

https://codebeautify.org/javascript-escape-unescape

Then take that out put and put it back into your project to see if it works.

Hi Davin,

Thanks for your reply,

I am using java code to achieve this. After changing the JSON escape format also no luck.

I got the "500 Internal Server Error".

Can you please help me on this.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

What do you think is the most *delightful* Confluence feature? Comment for a prize!

- Create your own custom emoji 🔥 - "Shake for Feedback" on mobile 📱 - An endless supply of GIFs via GIPHY 🤩 Is there anything quite as nice as a pleasant surprise? Comment below with what...

494 views 24 9
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you