Is there a way to get a list of pages in the current location using a REST API?

Kathleen Janiszewski November 16, 2023

Is there a way to get a list of the pages in the current space using a REST API?

Why, you may ask?

My customer wants to be able to create a page using an IFTTT macro using a template.  If there's already a page with that same name within that same name, they want to flag an error before the page is created.  They use a ConfForm to create the page, then I delete the form once the page is created.  However, if a form with that same name exists within that space, the onCreate will fail.  They want a way to check the uniqueness within the space before that, so that the onCreate doesn't fail.  Is there a way to do that from the IFTTT macro?  I was thinking a REST API would do the trick.

Thank you in advance!

-Kathleen J

2 answers

1 vote
Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 16, 2023

Hi @Kathleen Janiszewski 

Guess the search endpoint should do the work. You could just send a CQL filtering for the specified space:

https://docs.atlassian.com/ConfluenceServer/rest/8.6.1/#api/search

Best
Stefan

0 votes
Alex Medved _ConfiForms_
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.
November 17, 2023

Hi @Kathleen Janiszewski 

What is the problem with a failed submit? Why could not they retry providing a new name?

But, as @Stefan Salzl mentioned there is an API endpoint you are asking for

Alex

Kathleen Janiszewski November 17, 2023

Alex,

They don't want the data from the ConfForm stored.  They want to use it to create the page, then delete the entry.    I explained that normally I would put a validation rule on the ConfiForm field for uniqueness.  However, that won't work because they don't want to keep the entry.  Then asked the following:

Can the IFTTT check of the page exists right after the users enters the name, before entering any the other information? And if the page exist, pass an error message. If the user tries to create a new page with the same title as an existing page, do not overwrite the existing. The system should create a hard edit: “This item has already been entered. Please verify the name or make updates to the existing item."

The error occurs with the IFTTT macro onCreate, when the page title already exists in the space.  I tried it.  The page simply doesn't get created, and the ConfiForm entry is still there.  I can remove the entry - that's not a problem.  If you know another way to check for the existence of the page name within that space either with a Rule or on the Submit, I'm all ears!

Thank you in advance.

-Kathleen J

Alex Medved _ConfiForms_
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.
November 17, 2023

You can set up a form to remove the entry onError (IFTTT to delete an entry, set onError event with a filtering expression set to something like id:[entry.id] to delete the current record only) - so there is nothing left after the failed try. 

Alex

Like Kathleen Janiszewski likes this
Kathleen Janiszewski November 22, 2023

Alex,

Thanks for the hint.  I think I may have found the solution.

Thank you!

-Kathleen J

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events