# Using the API to add new links using only \_id

**URL:** <https://discourse.getcockpit.com/t/using-the-api-to-add-new-links-using-only-id/2244>\
**Category:** Support\
**Created:** [February 10, 2022, 4:57pm UTC](https://discourse.getcockpit.com/t/using-the-api-to-add-new-links-using-only-id/2244 "2022-02-10T16:57:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gclaudel](https://avatars.discourse-cdn.com/v4/letter/g/dbc845/32.png) [@gclaudel](https://discourse.getcockpit.com/u/gclaudel)\
**Post date:** [February 10, 2022, 4:57pm UTC](https://discourse.getcockpit.com/t/using-the-api-to-add-new-links-using-only-id/2244/1 "2022-02-10T16:57:34Z")

</div>

Hi all!

I have 2 collections :

```auto
Collection A {
  String groupName;
  CollectionLink<Collection B> users;
}

```

When I add a new user using the API with a request like :

```auto
{
    "data": {
        "_id": "idOfTheCollectionAIWantToUpdate",
        "users": [
            {
                "_id": "IdOfAUserIWantToAdd"
            }
        ]
    }
}

```

I can see that the request worked because cockpit recognizes the new user on the web interface. But when I use the cockpit’s API to get the edited collection, cockpit gives me a JSON with only the user’s ID :

```auto
Collection A {
    "groupName": "AwesomeName",
    "users": [
        {
            "_id": "IdOfAUser"
        }
...

```

When I want something like :

```auto
...
Collection A {
    "groupName": "AwesomeName",
    "users": [
        {
            "_id": "IdOfAUser",
            "username": "MyAwesomeUserUsername",
            "email": "email@....",
            // all the other fields of the user
        }
...

```

Is it possible to achieve this ?  
Thank you ! 🙂

---

<div class="post-metadata">

**Author:** ![ronaldaug](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/ronaldaug/32/260_2.png) [@ronaldaug](https://discourse.getcockpit.com/u/ronaldaug)\
**Post date:** [February 15, 2022, 4:50am UTC](https://discourse.getcockpit.com/t/using-the-api-to-add-new-links-using-only-id/2244/2 "2022-02-15T04:50:06Z")

</div>

You have to use `populate` to view all fields. Add `?populate=1` after the URL and it should work.  
e.g

```auto
https://[your_domain]/api/collections/get/[your_collection]?token=[your_token]&populate=1

```
