Skip to main content
Hey folks, we're trying to leverage the API to pull all cards in our knowledge base as we're building a find&replace MVP. We're using the search endpoint with a blank query to list all cards but it appears to be timing out. It stops printing at 8952 cards and that figure doesn't appear to bear any significance. Would you be able to shed any light on why that might be the case? I'll thread the code for reference.
`def getCards(url):`

`payload = "{

"q":""

}"`

`headers = {`

`'Authorization': 'Basic {{user token}}',`

`'Content-Type': 'application/json'`

`}`

`if url=="https://api.getguru.com/api/v1/search/query?":`

`response = requests.request("GET", url, headers=headers, data = payload)`

`else:`

`response = requests.request("GET", url, headers=headers)`

`jsonResponse = json.loads(response.text)`

`with open("cards.txt",mode='a') as f:`

`for card in jsonResponse:`

`f.write(card["id"])`

`f.write("

")`

`if len(response.headers['Link']) > 0:`

`return response.headers['Link'].replace("<","").replace(">","").replace("; rel="next-page"","")`

`else:`

`return False`
I initially tried to simply export all cards but the export never lands in my inbox. I suspect this is due to the size of our current KB. If all else fails, would you be able to send me an export of our entire knowledge base?
Thanks for flagging this @ruairi.murphy. I've pinged a couple of people to respond here, hang tight and we'll get you an answer on this ASAP.
Hey @ruairi.murphy! Is the authorization for the API call using your username? Or someone else? 8952 is a weird number to stop at because it should be pages of 50 at a time, so I'm wondering if you can see more cards than that but the account being used to authorize the calls has more limited access.
Hey Rob, another admin used their token for the API call but they have the same collection access as I do so that shouldn't be a factor 🤔

Reply