dragonroll/documentation/docs/client/test.md
BinarySandia04 6b558b2e3d
All checks were successful
test / run-tests-client (push) Successful in 20s
test / run-tests-backend (push) Successful in 16s
Better docs
2024-10-11 12:50:46 +02:00

41 lines
716 B
Markdown

# Updating a resource
## Request
- HTTP Method: `PUT`
- Content Type: `application/json`
- URL: `http://example.com/users/{id}`
## Parameters
| Property | Type | Required | Description |
| -------- | ---- | -------- | ----------- |
| ``name`` | String | false | The name of the user. |
| ``age`` | Number | false | The age of the user. |
## Request example
``` js
fetch('http://example.com/users/1', {
method: 'PUT',
body: JSON.stringify({
name: 'John Doe',
age: 27,
}),
headers: {
'Content-type': 'application/json',
},
})
.then((response) => response.json())
.then((json) => console.log(json));
```
## Response example
``` JSON
{
"id": 1,
"name": "John Doe",
"age": 27
}
```