Creates a new account
const options = {
method: 'POST',
headers: {'Content-Type': 'application/vnd.api+json'},
body: JSON.stringify({
user: {
email: 'john@snow.org',
first_name: 'John',
last_name: 'Snow',
selected_locale: 'en',
password: 'spree123',
password_confirmation: 'spree123',
public_metadata: {user_segment: 'supplier'},
private_metadata: {has_abandoned_cart: false}
}
})
};
fetch('https://demo.spreecommerce.org/api/v2/storefront/account', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));Was this page helpful?
const options = {
method: 'POST',
headers: {'Content-Type': 'application/vnd.api+json'},
body: JSON.stringify({
user: {
email: 'john@snow.org',
first_name: 'John',
last_name: 'Snow',
selected_locale: 'en',
password: 'spree123',
password_confirmation: 'spree123',
public_metadata: {user_segment: 'supplier'},
private_metadata: {has_abandoned_cart: false}
}
})
};
fetch('https://demo.spreecommerce.org/api/v2/storefront/account', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));