post
https://{store}/api/rest/companyAccounts/account/
/** JavaScript Post Data Example **/
const accountName = "Test Account6"; // needs to be different every time you post.
const locationId = "_tempLocationId1";
const locationName = "Test Account";
const customerId = "586"; // Customer ID
const customerRoleId = "466"; // Role ID
const address = {
"address_type": "billing,shipping",
"firstname": "John",
"lastname": "Doe",
"street": [ "1234 Park Ave" ],
"city": "New York",
"region": "New York",
"region_id": "43",
"postcode": "12345",
"country_id": "US",
"telephone": "1234567890",
"location_ids": [ locationId ]
}
const customer = {
"customer_id": customerId,
"is_main_contact": 1,
"role_id": customerRoleId,
// customer_data is optional
"customer_data": {
"firstname": "first",
"lastname": "last"
}
}
const location = {
"id": locationId,
"name": locationName,
"status": 1,
"enable_all_shipping_methods": 1,
"enable_all_payment_methods": 1,
"enable_all_invoice_payment_methods": 1,
"payment_methods": [],
"customers": [ customer ]
};
const netterms = {
"enabled": "1",
"term": "net30",
"credit": "1500",
"detail": "[store_name] has offered [customer_name] payment terms of [term_name]. Payment is due within [term_period] days for this order"
}
const postData = {
"companyData": {
"name": accountName,
"external_id": "TEST 123",
"enable_all_shipping_methods": 1,
"enable_all_payment_methods": 1,
"enable_all_invoice_payment_methods": 1,
"status": 1,
"addresses": [ address ],
"customers": [ customer ],
"locations": [ location ],
"netterm": netterm,
"customer_email_receive_as_cc_setting": 0,
"customer_email_receive_own_setting": 1,
"customer_email_setting": 1,
"customer_manage_address_setting": 1,
"customer_manage_customer_setting": 1,
"customer_manage_location_setting": 1,
}
}
console.log(JSON.stringify(postData));
Recent Requests
Log in to see full request history
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
Loading…
