The POST
{{baseUrl}}/customer
endpoint is designed to facilitate the creation and storage of new customer records within the system.
POST
/customer
Parameter | Description |
---|---|
customer_name | required, customer’s full name |
customer_email | required, customer’s email |
customer_phone | required, customer’s phone number |
customer_type | Not required, Accepts individual or business, if not passed it defaults to individual |
const url = '{{baseUrl}}/customer';
const payload = JSON.stringify({
"customer_name": "Customer Name",
"customer_email": "[email protected]",
"customer_phone": "+xx xxxx xxxxx",
"customer_country": "USA",
"customer_type": "individual", // or business, defaults to individual when not passed
});
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJ0xxxxxxxxxxx'
},
body: payload
};
fetch(url, options)
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok ' + response.statusText);
}
return response.json();
})
.then(data => console.log('Customer created:', data))
.catch(error => console.error('Error:', error));