Is it possible to link to a not-already-created undefined page in Confluence from an external site?

Kerrin Hardy August 23, 2012

I would like to make it easy for information to be added to our Confluence wiki by including a link from within one of our corporate systems. Ideally I would like to be able to hard code the first part of the link and then append each record name (produced by the corporate system) which then links to a wiki page of the same name. If the page already exists, it will open in Edit mode, but if the page does not already exist, then it creates it and opens it in Edit mode (just like an internal undefined page).

The link that an undefined page uses is in the format http://confluence.xxx.com/pages/editpage.action?pageId=1442146#. However, as the page has not already been created, we do not have an ID number. In any case, this means that we can't generate the links to the pages automatically either.

Is there a mode/setting that we can operate in that if you follow a link to a non-existent page, that rather than get a 'Page not found' message, a new page opens in Edit mode ready for adding content?

I hope I've explained this clearly - if not, please let me know.

Cheers
Kerrin

7 answers

1 accepted

1 vote
Answer accepted
Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 28, 2012

Go to a page and create a link to another page that doesn't exist and then look at the url. Something like:

http://xxxxx/pages/createpage.action?spaceKey=experiment&title=this+does+not+exist&linkCreation=true&fromPageId=623770

Kerrin Hardy September 2, 2012

Thanks @bob-swift - that looks like it does the trick. linkCreation=true is the key.

I've not included the fromPageId though - do you think that this will cause any issues?

Kerrin Hardy September 3, 2012

Hi Bob

Just wondering if I could follow up with you on an extension to this question. I would love to also be able to provide a link that either opens up a page (if it exists) OR opens a new page in Edit mode (if it doesn't exist) with a page template applied.

I've tried the link below:

http://domain.com/pages/createpage.action?spaceKey=SERVERS&linkCreation=true&templateId=3375105&title=server-01

This works whether the page exists (opens in view mode) or not (opens in edit mode) - however it does not appy the page template.

I've also tried another alternative:

http://domain.com/pages/createpage-entervariables.action?spaceKey=SERVERS&templateId=3375105&title=server-01

This applies the template and works fine if the page does not exist yet. But on subsequent visits to the link, it tries to create it again - rather than just open it in view mode.

What do you think? Is it possible?


Thanks,
Kerrin

Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 3, 2012

Sorry, don't know. Maybe someone else can help?

Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 5, 2012

Unlikely...

0 votes
Jerome Bleichenbacher September 25, 2017

(sorry, wrong place for my post)

0 votes
Donald Mull August 25, 2013

You can count me as yet another person that just assumed this features was a given.

I thought the linkCreation=true link would work but not all of my users have permissions to create/edit so it fails for them even if the page already exists.

I'm out of ideas here. Even the "not found" page doesn't have a create link on it. I'm simply trying to present a link to my users that takes them to the relevant page or if it doesn't exist (and they have permission to create) it starts the page for them.

0 votes
Gabriel Lozano-Moran August 12, 2013

I am sorry for reviving this thread but we are looking for exactly the same as Kerrin. We have an external system that links to the wiki, if a page exist it should show the existing page and if the page does not exist it should create a new one based on a template.

Update:

This url creates the page if it does not exist but opens the page in Edit mode if it exists (which is not the desired behaviour):

http://wiki.*.org/pages/createpage-entervariables.action?spaceKey=COM&linkCreation=true&templateId=3506191&title=gabriel

The following url creates the page if it does not exist and shows the page if it exists but the prob here is that I cannot use a template:

http://wiki.*.org/pages/createpage.action?spaceKey=COM&linkCreation=true&templateId=3506191&title=gabriel

A late answer, but I think I figured this one out:

http://domain.com/pages/createpage-entervariables.action?spaceKey=<spacekey>&fromPageId=<parent page id>&templateId=<template id>

This works for me at least.

I added a post about this, and added a JavaScript feature to do this automatically for the page: http://phun-ky.net/2014/03/25/how-to-create-a-new-page-in-confluence-with-given-template-from-a-link/

EDIT: had wrong link in the example solution

Brent Lewis March 27, 2014

Thank you Alex. I am trying this but not able to get the template to be applied (just use the URL above, not the javascript).

I got my template ID by copying the URL to edit it, taking the number of the entityId.

editpagetemplate.action?entityId=964788230

My full URL is

https://domain.com/devspace/pages/createpage-entervariables.action?spaceKey=BQIHRRB&fromPageId=965678634&templateId=964788230

Any thoughts for what I'm doing wrong here?

Brent Lewis March 27, 2014

Disregard my prior message - it is working great. Not sure why it didn't work the first attempt but it is now so I'm happy!

Jerome Bleichenbacher September 25, 2017

I tried all of those:

http://URL/pages/createpage.action?spaceKey=XXXX&templateId=2097153
http://URL/pages/createpage.action?spaceKey=XXXX;templateId=2097153
http://URL/pages/createpage.action?spaceKey=XXXX&templateId=2097153


But none of them worked! Maybe I'm using the wrong templateId - how can I figure it out?

0 votes
Martin Cleaver
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 23, 2013

Wow. This is standard functionality in wikis like Foswiki / TWiki.

0 votes
Ben Simo December 6, 2012

I am encountering this same issue.

I'd like to link to a Confluence wiki from another system, and create the page if it does not already exist. I can do this with MediaWiki without any problem. However, Confluence requires I use different URLs depending on whether I want to create or view a page:

existingPage = wikidomain + "/display/" + wikispace + "/" + title;

newPage = wikidomain + "/pages/createpage.action?spaceKey=" + wikispace + "&title=" + title;

I tried throwing a Javascript wrapper over the application from which I want to link to Confluence pages that detects whether the page exists and then use the appropriate URL. However, this doesn't work due to browser security not permitting me to HEAD a URL that comes from another domain.
Is there any Confluence URL for pages that basically tells Confluence to show me the page if it exsits, and create it if it doesn't exist?
Ben
0 votes
Kerrin Hardy August 28, 2012

Anyone?

This is something that we do with MediaWiki and it's important to be able to do this as part of the integration with our other IT management systems.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events