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

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

<br />

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.


Answers:
author: Ankit Rastogi
body: Thanks [@Dam](/t5/user/viewprofilepage/user-id/722152)

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.


author: Dam
body: Hi [@Ankit Rastogi](/t5/user/viewprofilepage/user-id/2727884) ,

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.

comments: author: Ankit Rastogi
body: Thanks [@Dam](https://community.atlassian.com/t5/user/viewprofilepage/user-id/722152)

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.


author: Ankit Rastogi
body: 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?


author: Dam
body: hi [@Ankit Rastogi](/t5/user/viewprofilepage/user-id/2727884)
> 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.


author: Ankit Rastogi
body: Thanks [@Dam](/t5/user/viewprofilepage/user-id/722152) for quick resonse


Tags: cloud

confluence-cloud