I've tried several API requests in the browser and get expected responses.
I try the same requests via Python's request lib and execute the script from the command line. However, I get empty results (though the request was registered as valid). I've set the limit to the max (500) and still get no results.
I understand that the limit refers to the number of items retrieved from the given request based on parameters, but I figured I'd try it out. At this point, I only need to retrieve 1 page so that I can do a POST request. I've tried hard-coding the page id so my API request looks like this:
https://mybaselink.com/rest/api/content/pageidiwant
That request successfully gets the page in the browser, but my Python script says the page does not exist. If my script doesn't see that the page exists, I'm assuming I can't POST to it.
Does this contradiction have to do with 'next' parameter found in large JSON files? Considering I've made specific arguments, I thought there would be a nonissue here.
Hi @Emily Kern,
You are basically doing a GET request for the content API /rest/api/content/<YOUR_PAGE_ID>.
If you execute the request from the browser it works because your user is authenticated respectively the browser has a valid cookie.
Executing the request without authentication context will return an error or 0 results because in this case "anonymous" can't see that page - thus it does not work in your script.
To provide this information please read the following articles:
- Confluence Cloud : https://developer.atlassian.com/cloud/confluence/basic-auth-for-rest-apis/
- Confluence Server : https://developer.atlassian.com/server/confluence/using-the-rest-apis-prototype-only/
Best, Tobias
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.