Hello Confluence Experts,
I have a use case wherein I need to import a MS Excel data into Confluence.
One excel row needs to be created as one new page and columns in that excel needs to mapped/linked to another existing static pages in the the same Confluence space.
By reading some Confluence docs, I got to know that I might need to create a new custom User Macro to perform this import.
Can any expert guide me further Or if someone working on similar macro help me out to do it fast?
Thanks in advance.
this is a main part of creating a new page in confluence
mypage = {"type":"page","title":""+NEWPAGENAME+"","ancestors":[{"id":PARENTID}],"space":{"key":""+SPACEKEY+""},"body":{"storage":{"value":"" + PAGE_IN_STORAGE_FORMAT+ "", "representation": "storage"}}}
post = requests.post(url+'/rest/api/content/', data=json.dumps(mypage), auth=auth, headers=headers, verify=False)
newpageId = json.loads(post.text)['id']
You need auth and headers:
headers = {
'X-Atlassian-Token': 'no-check',
'Content-Type': 'application/json'
}
auth=(user, password)
This is written in python
Regards, Dominic
You do not need a user macro for this.
What you need is a script (Python or something else) which uses the REST API from confluence to create the pages.
All about REST API is here: https://docs.atlassian.com/ConfluenceServer/rest/7.16.2/
You will need the Create Content section.
Regards, Dominic
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your valuable suggestion.
Do you have any sample script calling Content creation APIs of Confluence?
If yes, that would be really great.
Thanks..!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.