Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Nested expand is not working in current user API.

webmethods-integration July 23, 2020

We are using 'Get current user' API call of confluence cloud(https://developer.atlassian.com/cloud/confluence/rest/api-group-users/#api-api-user-current-get).

 

When we use '?expand=operations,personalSpace' in the API call, we are able to get the expanded result but when we try using nested expand '?expand=personalSpace.settings'. The API is not providing us the nested expand results like they do in normal API call.

 

We also face the similar issue in the below API calls:

GET https://mydomain/wiki/rest/api/space/{SampleSpaceKey}/content/page

GET https://mydomain/wiki/rest/api/space/{SampleSpaceKey}/content/blogpost

 

We are not getting nested expand after 2nd level.

We are able to get nested expand up to 'container.settings' but when we use 'container.settings.homepage'. The nested expand is not functioning. 

 

Does Anybody faced the similar issues mentioned above or had a solution for the above issues?

 

Thanks.

WMIO

1 answer

0 votes
Diego
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 27, 2020

Hello @webmethods-integration !

As I understand, you need to go deeper into the expand hierarchy but the resulting response is not the expected value.

 

Looking at your proposed value for the REST call, I believe that this will end up looking for the value under the expanded settings from the container.

If we look at the reply from the call “atlassian.net/wiki/rest/api/space/SPACEKEY/content/page?expand=container

We see that these are under the expandable content:

  • Settings
  • Metadata
  • Operations
  • lookAndFeel
  • permissions
  • icon
  • description
  • theme
  • history
  • homepage

Since homepage and settings are on the same level (right under Container), I believe that the call we need to send to get values from both homepage and settings is this:

atlassian.net/wiki/rest/api/space/SPACEKEY/content/page?expand=container.settings,container.homepage

Looking under settings we can see that no value is listed as expandable. So it is safe to assume that there is nothing to be expanded there.

Using this method, I was able to expand up to the last level of the homepage field, which was this:

atlassian.net/wiki/rest/api/space/BBRY/content/page?expand= container.homepage.version.collaborators.users.operations

Now, when I try to use the same approach with atlassian.net/wiki/rest/api/user/current ?expand=personalSpace.settings I am unable to. This might be due to some limitation of the Get User method. I am not sure about why this is happening. The value we are looking to expand is, in fact, not listed as available in the documentation:

Screen Shot 2020-07-27 at 17.14.19.png

What I know is that you should be able to get the desired details by using REST. Here is how I got the space settings for that particular personal space:

atlassian.net/wiki/rest/api/user/current?expand=personalSpace,settings

The thing with this approach is that, if any other field has an expandable settings value, it will be expanded as well. But the settings values for the personalSpace field are correctly expanded this way.

Let me know if there is still any question about how to fetch the desired values!

I hope this helps.

Suggest an answer

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

Atlassian Community Events