Confluence API only returning 500 unique records

pmf
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 17, 2024

This was working fine until this week - now Confluence is only returning 500 unique page_ids when there are 1000s of actual pages in the space. Any idea if there is some limit?

 

I was previously using 

confluence.get_space_content(key,start=start,limit=limit) but this is now only returning 100 records
As you can see from the below results PAGES never increasing past 500. Also, there is always a NEXT link and the same 500 records just cycle over forever. Is there an issue with the API?
####

 

import requests

TOKEN ="1234567890"
BASE_URL = "https://confluence.internal.mycompany.com"
PAGES = set()

 

def get_all_results():
    headers = {'Authorization': f'Bearer {TOKEN}'}
    next_link = "/rest/api/space/myspace/content/page?limit=200&start=0" #initial url

    while next_link:

        url = BASE_URL + next_link
        print(f"url: {url}")
        try:
            response = requests.get(url, headers=headers, verify=False)
            data = response.json()
            results = data.get('results', [])
            links = data.get('_links')
            next_link = links.get('next', None)

            for result in results:
                page_id = result.get('id')
                if page_id not in PAGES:
                    PAGES.add(page_id)

            print(f"PAGES: {len(PAGES)}")

        except requests.exceptions.RequestException as e:
            print(f"Error fetching the URL: {e}")
            breaK

    return PAGES

 

if __name__ == "__main__":
    get_all_results()

 

 


###Results

url: https://confluence.internal.mycompany.com/rest/api/space/myspace/content/page?limit=200&start=0
PAGES: 200

url: https://confluence.internal.mycompany.com/rest/api/space/myspace/content/page?limit=200&start=200
PAGES: 400

url: https://confluence.internal.mycompany.com/rest/api/space/myspace/content/page?limit=200&start=400
PAGES: 500

url: https://confluence.internal.mycompany.com/rest/api/space/myspace/content/page?limit=200&start=600
PAGES: 500

url: https://confluence.internal.mycompany.com/rest/api/space/myspace/content/page?limit=200&start=800
PAGES: 500

1 answer

0 votes
Franz Mittendorfer
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 21, 2024

Hi,

I get the same issue as you. Are you using Data Center Edition? If yes which version?

BR Franz

pmf
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 23, 2024

We are using version 8.5.8

Franz Mittendorfer
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 24, 2024

I'm pretty confident that it is a bug. Check out this issue and the closed dupliactes. https://jira.atlassian.com/browse/CONFSERVER-95272?src=confmacro

My guys have planned an update to .9 in the next weeks, I hope it is solved then.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events