- Core API's
- >
- Users API
- >
- Users - Create
Users - Create API
Create a new User.
Method POST
Body
{
"name": "John Doe",
"email": "johndoe@example.com",
"password": "password"
}
How to Use
fetch('https://simplecrudapi.com/api/users', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'John Doe',
email: 'john.doe@example.com',
password: 'securePassword123'
})
})
.then(response => response.json())
.then(json => console.log(json))
.catch(error => console.error('Error creating user:', error));
Response
{
"data": {
"id": "1",
"name": "John Doe",
"email": "john.doe@example.com",
"email_verified_at": "2024-11-11T12:00:00Z",
"created_at": "2024-10-01T08:45:00Z",
"updated_at": "2024-11-10T15:30:00Z"
}
}
Try Now
fetch('https://simplecrudapi.com/api/users', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'John Doe',
email: 'john.doe@example.com',
password: 'securePassword123'
})
})
.then(response => response.json())
.then(json => console.log(json))
.catch(error => console.error('Error creating user:', error));