Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Confluence CQL Request is inconsistent

Bjarne Schmitz
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!
August 18, 2023

Hello when I make the following request to the Confluence Cloud Api I get a different result every time. How is this possible? We just migrated from the Server to Cloud. When I add a sleep time the result is higher, but also inconsistent. What am I doing wrong? Is somebody facing the same problem when executing the script?

 

# This code sample uses the 'requests' library:
# http://docs.python-requests.org
import requests
from requests.auth import HTTPBasicAuth
import json
from time import sleep

url = "https://<domain>.atlassian.net/wiki/rest/api/content/search?cql=space=<space>"

auth = HTTPBasicAuth("<user>", "<api_key>")

headers = {
"Accept": "application/json"
}


amount = 0
while True:
response = requests.request(
"GET",
url,
headers=headers,
auth=auth
)
json = response.json()
#sleep(10)

amount += len(json["results"])
if "next" in json["_links"]:
url = "https://<domain>.atlassian.net/wiki" + json["_links"]["next"]
else:
break

print(amount)

 

1 answer

0 votes
Gonchik Tsymzhitov
Community Champion
August 31, 2023

hi! looks like issue with ordering

Bjarne Schmitz
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!
August 31, 2023

I dont know, but when I tried to set the orderBy flag, the problem was the same. Maybe the problem is the internal ordering?

Like Gonchik Tsymzhitov likes this
Gonchik Tsymzhitov
Community Champion
September 4, 2023

maybe need to request make a reindex of content

Like Bjarne Schmitz likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events