Urgent: By which permission (Api key) can use to fetch all pages count (including-Restricted7 dele)

Ankit Rastogi June 24, 2022

Requirement: Urgently: By which permission (API key) we can use API to fetch all pages count (including-Restricted & deleted) per space.

Currently Using: I am using '/wiki/rest/api/content?' API to fetch page counts with my API key(credentials) but it is not giving page counts which are restricted & deleted on the cloud. However, if I am running '/rest/api/content?' on the on-prem system it is giving page count including restricted & deleted pages


Why: We are migrating our confluence instance to the cloud so want to compare page count per space after migration to make sure nothing was missed because as we did the same on test instance and we observed few pages missed in migration but migrated successfully when we re-run again.

2 answers

0 votes
Ankit Rastogi June 27, 2022

Thanks @Dam 

Is there any way to give access on restricted pages for all spaces in one go so that API can return count including restricted & deleted pages?

As I know we can give access to restricted page by page itself. Open restricted page and add user/group for view/edit. But it is not possible to do manually for every page.

I am asking because as I want to give access to my self. As on my instance, we have 250 spaces and have many restricted pages on each space.

0 votes
Dam
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 24, 2022

Hi @Ankit Rastogi , 

I'm afraid you can't in Confluence Cloud API, the doc is clear: https://developer.atlassian.com/cloud/confluence/rest/api-group-content/#api-wiki-rest-api-content-get

"Only content that the user has permission to view will be returned."

But with the expand options you can view where restrictions are and who can edit or view:

  • restrictions.read.restrictions.user returns the users that have permission to read the content.
  • restrictions.read.restrictions.group returns the groups that have permission to read the content. Note that this may return deleted groups, because deleting a group doesn't remove associated restrictions.
  • restrictions.update.restrictions.user returns the users that have permission to update the content.
  • restrictions.update.restrictions.group returns the groups that have permission to update the content. Note that this may return deleted groups because deleting a group doesn't remove associated restrictions.

I hope it helps a bit.

Cheers,
Dam. 

Ankit Rastogi June 27, 2022

Thanks @Dam 

Is there any way to give access on restricted pages for all spaces in one go so that API can return count including restricted & deleted pages?

As I know we can give access to restricted page by page itself. Open restricted page and add user/group for view/edit. But it is not possible to do manually for every page.

I am asking because as I want to give access to my self. As on my instance, we have 250 spaces and have many restricted pages on each space.

Ankit Rastogi June 27, 2022

Another Question.

How we can use site admin key for API? I mean how can I fetch API key for my site admin access because I am using site admin access on UI to see restricted pages?

Dam
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 27, 2022

hi @Ankit Rastogi 

Is there any way to give access on restricted pages for all spaces in one go so that API can return count including restricted & deleted pages?

Well by script calls to the API it doable but there is no others ways around as far as I know... 

 

How we can use site admin key for API? I mean how can I fetch API key for my site admin access because I am using site admin access on UI to see restricted pages?

Well just create an API key with the site admin user account... if you see restricted pages or deleted content with it, it should be the same using API cause permissions match in all cases: from the UI or from the APIs normally.

Just create an API token with the proper user account: 

https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/

I hope this helps again ;) 

Cheers,
Dam. 

Ankit Rastogi June 27, 2022

Thanks @Dam  for quick resonse

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events