/customer/{customerId}/update v1.0.0
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
Base URLs:
Customers
postCustomerIdUpdate
Code samples
const inputBody = '{
"type": "object",
"properties": {
"params": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"domain": {
"type": "string",
"nullable": true
},
"erpId": {
"type": "string",
"nullable": true
},
"city": {
"type": "string"
},
"region": {
"type": "string"
},
"postalCode": {
"type": "string"
},
"country": {
"oneOf": [
{
"type": "string"
},
{
"type": "object",
"properties": {
"countryName": {
"type": "string"
}
}
}
]
},
"phoneNumber": {
"type": "string",
"nullable": true
},
"email": {
"type": "string",
"format": "email"
},
"website": {
"type": "string",
"format": "uri"
},
"address1": {
"type": "string"
},
"address2": {
"type": "string"
},
"defaultLengthUnit": {
"type": "string"
},
"defaultLengthUnitBillOfMaterials": {
"type": "string"
},
"defaultPressureUnit": {
"type": "string"
},
"defaultCurrency": {
"type": "string"
},
"defaultTaxCode": {
"type": "string"
},
"contactCustomerForResale": {
"type": "boolean"
},
"defaultMarginPercentMaterials": {
"type": "number",
"format": "float"
},
"defaultMarginPercentLabour": {
"type": "number",
"format": "float"
},
"listPricing": {
"type": "boolean"
},
"defaultDiscountPercentMaterials": {
"type": "number",
"format": "float"
},
"defaultDiscountPercentHoses": {
"type": "number"
},
"defaultDiscountPercentCrimpFittings": {
"type": "number"
},
"defaultDiscountPercentWraps": {
"type": "number"
},
"defaultDiscountPercentFerrules": {
"type": "number"
},
"defaultDiscountPercentAdaptors": {
"type": "number"
},
"defaultDiscountPercentOtherItems": {
"type": "number"
},
"defaultItemPricing": {
"type": "array",
"items": {
"type": "object",
"properties": {
"itemType": {
"type": "string"
},
"defaultMarginPercent": {
"type": "number"
},
"defaultDiscountPercent": {
"type": "number"
},
"listPricing": {
"type": "boolean"
},
"enabled": {
"type": "boolean"
}
}
}
}
}
}
}
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json'
};
fetch('https://goldleaf.app/api/v1/customer/{customerId}/update',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /customer/{customerId}/update
Update a customer's details and settings
Updates customer properties and settings by customer ID. Only users with admin or regular roles are allowed. Admins can update pricing and margin fields. If no existing properties exist, a new one is created.
Body parameter
{
"type": "object",
"properties": {
"params": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"domain": {
"type": "string",
"nullable": true
},
"erpId": {
"type": "string",
"nullable": true
},
"city": {
"type": "string"
},
"region": {
"type": "string"
},
"postalCode": {
"type": "string"
},
"country": {
"oneOf": [
{
"type": "string"
},
{
"type": "object",
"properties": {
"countryName": {
"type": "string"
}
}
}
]
},
"phoneNumber": {
"type": "string",
"nullable": true
},
"email": {
"type": "string",
"format": "email"
},
"website": {
"type": "string",
"format": "uri"
},
"address1": {
"type": "string"
},
"address2": {
"type": "string"
},
"defaultLengthUnit": {
"type": "string"
},
"defaultLengthUnitBillOfMaterials": {
"type": "string"
},
"defaultPressureUnit": {
"type": "string"
},
"defaultCurrency": {
"type": "string"
},
"defaultTaxCode": {
"type": "string"
},
"contactCustomerForResale": {
"type": "boolean"
},
"defaultMarginPercentMaterials": {
"type": "number",
"format": "float"
},
"defaultMarginPercentLabour": {
"type": "number",
"format": "float"
},
"listPricing": {
"type": "boolean"
},
"defaultDiscountPercentMaterials": {
"type": "number",
"format": "float"
},
"defaultDiscountPercentHoses": {
"type": "number"
},
"defaultDiscountPercentCrimpFittings": {
"type": "number"
},
"defaultDiscountPercentWraps": {
"type": "number"
},
"defaultDiscountPercentFerrules": {
"type": "number"
},
"defaultDiscountPercentAdaptors": {
"type": "number"
},
"defaultDiscountPercentOtherItems": {
"type": "number"
},
"defaultItemPricing": {
"type": "array",
"items": {
"type": "object",
"properties": {
"itemType": {
"type": "string"
},
"defaultMarginPercent": {
"type": "number"
},
"defaultDiscountPercent": {
"type": "number"
},
"listPricing": {
"type": "boolean"
},
"enabled": {
"type": "boolean"
}
}
}
}
}
}
}
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| customerId | path | string | true | none |
| body | body | object | true | none |
| » params | body | object | false | none |
| »» name | body | string | false | none |
| »» domain | body | string¦null | false | none |
| »» erpId | body | string¦null | false | none |
| »» city | body | string | false | none |
| »» region | body | string | false | none |
| »» postalCode | body | string | false | none |
| »» country | body | any | false | none |
| »»» anonymous | body | string | false | none |
| »»» anonymous | body | object | false | none |
| »»»» countryName | body | string | false | none |
| »» phoneNumber | body | string¦null | false | none |
| body | string(email) | false | none | |
| »» website | body | string(uri) | false | none |
| »» address1 | body | string | false | none |
| »» address2 | body | string | false | none |
| »» defaultLengthUnit | body | string | false | none |
| »» defaultLengthUnitBillOfMaterials | body | string | false | none |
| »» defaultPressureUnit | body | string | false | none |
| »» defaultCurrency | body | string | false | none |
| »» defaultTaxCode | body | string | false | none |
| »» contactCustomerForResale | body | boolean | false | none |
| »» defaultMarginPercentMaterials | body | number(float) | false | none |
| »» defaultMarginPercentLabour | body | number(float) | false | none |
| »» listPricing | body | boolean | false | none |
| »» defaultDiscountPercentMaterials | body | number(float) | false | none |
| »» defaultDiscountPercentHoses | body | number | false | none |
| »» defaultDiscountPercentCrimpFittings | body | number | false | none |
| »» defaultDiscountPercentWraps | body | number | false | none |
| »» defaultDiscountPercentFerrules | body | number | false | none |
| »» defaultDiscountPercentAdaptors | body | number | false | none |
| »» defaultDiscountPercentOtherItems | body | number | false | none |
| »» defaultItemPricing | body | [object] | false | none |
| »»» itemType | body | string | false | none |
| »»» defaultMarginPercent | body | number | false | none |
| »»» defaultDiscountPercent | body | number | false | none |
| »»» listPricing | body | boolean | false | none |
| »»» enabled | body | boolean | false | none |
Example responses
500 Response
{
"type": "string"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | Successfully updated customer and returned updated settings | None |
| 500 | Internal Server Error | Server error | string |
