> 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/operating-an-endpoint-using-documentation.md).

# Utilisation d'un endpoint à l'aide de la documentation

Utilisation d'un endpoint à l'aide de la documentation notes for PortSwigger Web Security Academy labs, including exploitation workflow, payload testing, Burp Suite validation, and remediati

### Exploiter 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, y compris sous forme de **curl** commandes.

<figure><img src="https://3840167291-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-25a299a5a6ef0216e1435f685ef8f6b45855e8f6%2F%7BF84034CF-B750-45B1-B1A0-18404C268350%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

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

D'après la documentation, on observe qu'un point de terminaison permet de récupérer les informations d'un utilisateur en spécifiant son nom. / La requête fournie fournit des données 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="https://3840167291-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-d0a4b077ed12f06d1d52c3d3145d18a8a75daf67%2F%7B1AE03A8E-62A8-443F-9A51-3464E49D9F5F%7D.png?alt=media" 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="https://3840167291-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-efbdc4dd51179a013837c9c3cfe3e0d58b809ac6%2F%7BC1A96813-127E-4F44-A97C-F592F1E7B7CD%7D.png?alt=media" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
