atlassian-api / atlassian-python-api

Atlassian Python REST API wrapper
https://atlassian-python-api.readthedocs.io
Apache License 2.0
1.36k stars 664 forks source link

[Confluence] get_page_child_by_type without pagination parameters results in MissingSchema exception #957

Open kkosciusz opened 2 years ago

kkosciusz commented 2 years ago

When using get_child_pages() or get_page_child_by_type() without start or limit parameters the _get_paged() helper method fails to continue with pagination and constructs invalid request:

MissingSchema: Invalid URL 'rest/api/content/1325203670/child/page?next=true&limit=25&start=25': No scheme supplied.

Based on examples provided in the server REST API (https://developer.atlassian.com/server/confluence/pagination-in-the-rest-api/) and in cloud REST API (https://developer.atlassian.com/cloud/confluence/rest/api-group-search/#api-wiki-rest-api-search-get) the next link is relative, not absolute:

"_links": {
    "base": "http://localhost:8080/confluence",
    "context": "",
    "next": "/rest/api/space/ds/content/page?limit=5&start=5",
    "self": "http://localhost:8080/confluence/rest/api/space/ds/content/page"
},

It seems that _get_paged() should make requests with absolute = False or construct the url as base + next.

The change was introduced in https://github.com/atlassian-api/atlassian-python-api/pull/937 by @Spacetown

legoguy1000 commented 2 years ago

I"m getting this issue when trying to recursively delete pages confluence.remove_page(page['id'], recursive=True)

requests.exceptions.MissingSchema: Invalid URL 'rest/api/content/55512784/child/page?limit=25&start=25': No scheme supplied. Perhaps you meant http://rest/api/content/55512784/child/page?limit=25&start=25?
Spacetown commented 2 years ago

It seems that this depends on the used endpoint. With #990 this was fixed.