# Ressource d'Association

Supposons la ressource `/users/123ab/friends` :

```javascript
{
  "objects": [
    {
      "id": ...,
      "firstName": ...,
      "type": "user"
    } 
  ]
}
```

{% tabs %}
{% tab title="🧐" %}
Comment représenter la *datetime* de création du lien entre les utilisateurs ?
{% endtab %}

{% tab title="👍" %}
Nous pouvons créer une ressource de type collection qui représente ces liens.

Exemple : `/friendships?userId=123ab`

```javascript
{
  "objects": [
    {
      "id": "FRIENDSHIP_ID_1",
      "creationDateTime": "2017-01-01T18:16:00.000Z",
      "friend": {
        "id": ...,
        "type": "user"
      }
    },
    ...
  ]
}
```

... puis la ressource d'instance `/friendships/FRIENDSHIP_ID_1` permettant d'accéder, modifier ou supprimer la relation.\
Exemple : `DELETE /friendships/FRIENDSHIP_ID_1`.
{% endtab %}
{% endtabs %}


---

# 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://guide-api-rest.marmicode.fr/conventions-et-bonnes-pratiques/ressource-dassociation.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.
