Stream: troubleshooting

Topic: โœ” Fetch a hierarchical structure of user collections


view this post on Zulip Mohsen Jafari (Apr 23 2024 at 14:33):

I have used the following url to fetch user collections (by sending user api token):

${dataverse_url}/api/search?q=*&type=dataverse&sort=date&order=desc

And it returned the following structrue:

{
  q: '*',
  total_count: 7,
  start: 0,
  spelling_alternatives: {},
  items: [
    {
      name: 'some_name';
      type: 'dataverse',
      url: 'some_url',
      identifier: '59a7d6f8-ce52-417e-a5c0-dfd7695e41fd',
      description: '',
      published_at: '2024-04-22T13:35:33Z'
    },
    {
      name: 'some_name';
      type: 'dataverse',
      url: 'some_url',
      identifier: '70f86a0d-7763-40e0-b14a-f207e0d1ea98',
      description: '',
      published_at: '2024-04-22T13:21:55Z'
    },
    {
      name: 'some_name';
      type: 'dataverse',
      url: 'some_url',
      identifier: '53b4e2eb-c404-4156-aca9-abb5276378a7',
      description: '',
      published_at: '2024-04-22T11:52:59Z'
    },
    {
      name: 'some_name';
      type: 'dataverse',
      url: 'some_url',
      identifier: '9679bdfe-7d6f-48dc-af73-4c1c95e149ce',
      description: '',
      published_at: '2024-04-22T11:42:46Z'
    },
    {
      name: 'some_name';
      type: 'dataverse',
      url: 'some_url',
      identifier: 'b05db8c1-53dd-46dc-96e4-d08672178749',
      description: '',
      published_at: '2024-04-22T11:42:10Z'
    },
    {
      name: 'some_name';
      type: 'dataverse',
      url: 'some_url',
      identifier: 'pantabio',
      published_at: '2024-04-19T15:01:32Z'
    },
    {
      name: 'some_name';
      type: 'dataverse',
      url: 'some_url',
      identifier: 'my-dataverse',
      published_at: '2024-04-17T07:06:41Z'
    }
  ],
  count_in_response: 7
}

My intention is to show all collections that the user has access to (and can created a nested collection in them). I also need to show the this data in a hierarchy tree so that it is clear to the user that what collection is child of what collection and so on. How can I achieve this?

view this post on Zulip Philip Durbin ๐Ÿš€ (Apr 23 2024 at 14:46):

Huh. It's disappointing that for collections the Search API doesn't show the parent. (It does for datasets.) @Mohsen Jafari please feel free to open an issue about this.

view this post on Zulip Philip Durbin ๐Ÿš€ (Apr 23 2024 at 14:46):

Have you tried the MyData API? https://guides.dataverse.org/en/6.2/api/native-api.html#mydata

view this post on Zulip Philip Durbin ๐Ÿš€ (Apr 23 2024 at 14:46):

I'm not sure if it shows the parent or not.

view this post on Zulip Mohsen Jafari (Apr 24 2024 at 06:26):

Philip Durbin said:

Have you tried the MyData API? https://guides.dataverse.org/en/6.2/api/native-api.html#mydata

This API solved my problem.

view this post on Zulip Notification Bot (Apr 24 2024 at 06:26):

Mohsen Jafari has marked this topic as resolved.

view this post on Zulip Philip Durbin ๐Ÿš€ (Apr 24 2024 at 19:28):

Related: Fetch hierarchy structure of all collections of a user #10525


Last updated: Oct 30 2025 at 06:21 UTC