# API testing

## Lab: Exploiting an API endpoint using documentation

### Enunciado

Para resolver el laboratorio, encuentra la documentación de la API expuesta y elimina al usuario carlos.

Puedes iniciar sesión en tu propia cuenta con las siguientes credenciales:

* **Usuario:** `wiener`
* **Contraseña:** `peter`

### Resolución

Nos logueamos. Normalmente la API está en la ruta **/api**.

<figure><img src="/files/LPh6EoOQes7ZaKmVxPCY" alt=""><figcaption></figcaption></figure>

Enviamos petición.

<figure><img src="/files/Atx70NQUdgVmxykvhXN7" alt=""><figcaption></figcaption></figure>

Estamos autenticados con el usuario wiener. Sabiendo esto vamos a probar a borrar con el endpoint el usuario carlos (no valida bien los permisos).

<figure><img src="/files/slUxzJmRNXkMcYoDZnUj" alt=""><figcaption></figcaption></figure>

Lo borramos sin problemas.

<figure><img src="/files/Y54OednM8R7YCyrYOWp9" alt=""><figcaption></figcaption></figure>


---

# 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://beafn28.gitbook.io/beafn28/web-security/laboratorios-portswigger/api-testing.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.
