- Core API's
- >
- Users API
- >
- Users - Update
Users - Update API
Update the specified User.
Method PUT
Parameters
Name | Details | Type | Required |
---|---|---|---|
id
|
The ID of the User. | integer | Yes |
Body
{
"name": "string",
"email": "string",
"password": "string"
}
How to Use
fetch('https://simplecrudapi.com/api/users/1', {
method: 'PUT',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Updated Jane Doe',
email: 'janedoe@example.com',
password: 'newSecurePassword123'
})
})
.then(response => response.json())
.then(json => console.log(json))
.catch(error => console.error('Error updating user:', error));
Response
{
"data": {
"id": 1,
"name": "Updated Jane Doe",
"email": "janedoe@example.com",
"email_verified_at": null,
"created_at": "2024-11-09T12:34:56Z",
"updated_at": "2024-11-09T12:34:56Z"
}
}
Try Now
fetch('https://simplecrudapi.com/api/users/1', {
method: 'PUT',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Updated Jane Doe',
email: 'janedoe@example.com',
password: 'newSecurePassword123'
})
})
.then(response => response.json())
.then(json => console.log(json))
.catch(error => console.error('Error updating user:', error));