Hi,
I'm trying to write a script that moves all storage pages with no attachments to another page as their child so that they can be deleted later. I need a way to specify that the number of attachments is zero in my fetch request that I send out.
So far it takes all storage pages, but I only want the pages with no attachments to it.
Is there a way to do that?
Thanks!
Hello Splashy,
Using the API in conjunction with a script to do this task is a great idea. Ideally, you would want to get to the result in the least amount of effort.
Here is how I would approach this task:
This would be the shortest path to check all pages in a space to see if they have an attachment.
Regards,
Stephen Sifers
Hello Stephen,
thank you so much for the input (and provided links, I'm a newbie working with APIs and scripts so they helped a lot)!
What I had to do was delete move the child pages of one specific page and not for multiple pages. So i just adapted your suggestion.
I used a for loop, getting the attachments for each page and checking for their type and size, so that I could sort out all child pages without an attachment.
I just have a tiny question left. Is there a limit for how many pages I can get with the GET request? I know the default is 50.
Regards,
splashy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello again Splashy,
Very glad to hear you're able to find a solution!
For the follow up question, the page limit max I have seen is 200 pages(items) to be returned. However, you can set the page limit anywhere between 1-200. An example of this would be as follows:
"http://localhost:8080/confluence/rest/api/space/ds/content/page?limit=200"
There is a whole document which explains why this exists, how it works and when to use it. You may find that document at Pagination in the REST API.
Very glad to be of assistance, keep the great questions coming!
Regards,
Stephen Sifers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Stephen,
thank you for your fast and informative answer! I will take a look into the document you provided and finish up my script.
I wish you a good weekend!
Regards,
splashy
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.