I have a few questions about contentId

I am looking to use Confluence to store some content strings for another applicaiton, which will pull in the strings via the getContentById REST API.

What is assigned a contentId?  Can it be something smaller than a page?  Could I have a series of 10 strings on a page that each had a distinct contentId, such as if I put each one is a different macro?  Finally, how do I find the contentId for a piece of content?

2 answers

1 vote

Is this Confluence SERVER or Confluence CLOUD?

What is assigned a contentId

Any valid contentType. Out of the box, this includes Pages, Blog Posts, Comments, and Attachments.

Can it be something smaller than a page?

Well... Comments and Attachments I guess? 

Could I have a series of 10 strings on a page that each had a distinct contentId, such as if I put each one is a different macro?

Macros are not considered "contentTypes" so no, this is not supported out-of-the-box.

Finally, how do I find the contentId for a piece of content?

Use the API:

  • The JAVA API includes the PageManager with getPageWithComments(String spaceKey, String pageTitle) method. This will return a Page object with a getContentId() method.
  • The REST API includes a /content/ endpoint that allows you to specify a Space and a Page via Path Parameters: 
    /confluence/rest/api/content?title=myPage%20Title
    &spaceKey=TST

If you want to, you could extend ContentTypes in both Cloud or Server to add more flexibility for your use-case.

Confluence Server. Does that impact your reply at all?

Steven Behnke Community Champion Jun 17, 2017

I think at this point, all that I can say is that the API for adding new content types is different, Atlassian Connect has the ability to add new ContentTypes and of course you can extend it via the JAVA API on Confluence Server.

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 Apr 13, 2018 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...

874 views 21 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