Create a User
Creates a User
POST
/
api
/
v2
/
platform
/
users
Create a User
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
user: {
email: '<string>',
password: '<string>',
password_confirmation: '<string>',
first_name: '<string>',
last_name: '<string>',
selected_locale: '<string>',
ship_address_id: '<string>',
bill_address_id: '<string>',
public_metadata: {},
private_metadata: {}
}
})
};
fetch('http://{defaultHost}/api/v2/platform/users', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url http://{defaultHost}/api/v2/platform/users \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"user": {
"email": "<string>",
"password": "<string>",
"password_confirmation": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"selected_locale": "<string>",
"ship_address_id": "<string>",
"bill_address_id": "<string>",
"public_metadata": {},
"private_metadata": {}
}
}
'{
"data": {
"id": "136",
"type": "user",
"attributes": {
"email": "rex_champlin@breitenberg.com",
"first_name": "Zenia",
"last_name": "King",
"selected_locale": "pl",
"created_at": "2022-11-08T19:35:54.351Z",
"updated_at": "2022-11-08T19:35:54.351Z",
"public_metadata": {},
"private_metadata": {},
"average_order_value": [],
"lifetime_value": [],
"store_credits": []
},
"relationships": {
"bill_address": {
"data": null
},
"ship_address": {
"data": null
}
}
}
}{
"error": "Bill address belongs to other user",
"errors": {
"bill_address_id": [
"belongs to other user"
]
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Select which associated resources you would like to fetch, see: https://jsonapi.org/format/#fetching-includes
Body
application/json
Show child attributes
Show child attributes
Response
Record created
Show child attributes
Show child attributes
Was this page helpful?
⌘I
Create a User
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
user: {
email: '<string>',
password: '<string>',
password_confirmation: '<string>',
first_name: '<string>',
last_name: '<string>',
selected_locale: '<string>',
ship_address_id: '<string>',
bill_address_id: '<string>',
public_metadata: {},
private_metadata: {}
}
})
};
fetch('http://{defaultHost}/api/v2/platform/users', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url http://{defaultHost}/api/v2/platform/users \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"user": {
"email": "<string>",
"password": "<string>",
"password_confirmation": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"selected_locale": "<string>",
"ship_address_id": "<string>",
"bill_address_id": "<string>",
"public_metadata": {},
"private_metadata": {}
}
}
'{
"data": {
"id": "136",
"type": "user",
"attributes": {
"email": "rex_champlin@breitenberg.com",
"first_name": "Zenia",
"last_name": "King",
"selected_locale": "pl",
"created_at": "2022-11-08T19:35:54.351Z",
"updated_at": "2022-11-08T19:35:54.351Z",
"public_metadata": {},
"private_metadata": {},
"average_order_value": [],
"lifetime_value": [],
"store_credits": []
},
"relationships": {
"bill_address": {
"data": null
},
"ship_address": {
"data": null
}
}
}
}{
"error": "Bill address belongs to other user",
"errors": {
"bill_address_id": [
"belongs to other user"
]
}
}
