# Nested structure

### Overview

If you look into Raindrop UI you will notice a sidebar in left corner, where collections are located. Collections itself divided by groups. Groups useful to create separate sets of collections, for example "Home", "Work", etc.

![](https://3611960587-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M-GPP1TyNN8gNuijaj7%2F-M-odRbpHbUQpG6FIdE7%2F-M-oefnkLiSk6-lmT35A%2Fsidebar.png?alt=media\&token=e4070997-e45a-4310-a848-10995a597a6a)

`Groups` array is a single place where user **root** collection list and order is persisted. Why just not to save order position inside collection item itself? Because collections can be shared and they group and order can vary from user to user.

So to fully recreate sidebar like in our app you need to make 3 separate API calls (sorry, will be improved in future API updates):

#### 1. [Get user object](https://developer.raindrop.io/user/authenticated#get-user)

It contains `groups` array with exact collection ID's. Typically this array looks like this:

```javascript
{
  "groups": [
    {
      "title": "Home",
      "hidden": false,
      "sort": 0,
      "collections": [
        8364483,
        8364403,
        66
      ]
    },
    {
      "title": "Work",
      "hidden": false,
      "sort": 1,
      "collections": [
        8492393
      ]
    }
  ]
}
```

{% hint style="warning" %}
Collection ID's listed below is just first level of collections structure! To create full tree of nested collections you need to get child items separately.
{% endhint %}

To get name, count, icon and other info about collections, make those two separate calls:

#### 2. [Get root collections](https://developer.raindrop.io/v1/methods#get-root-collections)

Sort order of root collections persisted in `groups[].collections` array

#### 3. [Get child collections](https://developer.raindrop.io/v1/methods#get-child-collections)

Sort order of child collections persisted in collection itself in `sort` field


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.raindrop.io/v1/collections/nested-structure.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
