Update a company

UpdateCompany updates or creates a Company in Storm for the specified customer. Validation is done before trying to update or create the Company and the below Exceptions might be raised if any important information is missing. Any existing Company will be updated as well. Supply all root data (Code, Name, OrgNo, Phone, ReferUrl, Email, VatNo) about the Company - empty or missing input fields will be emptied. Note though that any missing lists or objects (Addresses, Flags, Info, DeliveryMethodIds, PaymentMethodIds) fields that are not passed in will not be removed but just not updated. PriceLists are not affected here at all.

Request
query Parameters
customerId
required
integer <int32>

The internal id of the Customer.

updatedBy
required
integer <int32>

Account internal id of current user. Pass 1 for the default account.

cultureCode
string

Specifies in which language to display culture specific information. If none is supplied, value is resolved from Application.

includeCompanies
string

Include full company data, if any, with the customer. Otherwise only primary company, if any, is included. Default is true.

Request Body schema:

The Company to update. If a supplied Company does not have an Id specified it is considered new and will be created as well. Otherwise it will be updated.

Id
integer or null <int32>

The internal Storm Id for the Company. When creating a new Company leave this blank as Storm will generate the Id.

Key
string <guid>

The system wide unique Key of the Company.

Code
string

The external code. Usually the id in the erp system. MaxLength: 50

Name
string

The Name of the Company. MaxLength: 100

OrgNo
string

The organizational number of the Company. Used to identify the Company for some payment methods. The combination of OrgNo and Name must be unique. MaxLength: 50

Phone
string

The Phone number of the Company. MaxLength: 50

ReferId
integer or null <int32>

Used to tag a Company with some external id.

ReferUrl
string

Used to tag a Company with an incoming URL. MaxLength: 255

Array of objects <Address> (Address)

A list of delivery Addresses for the Company. When needed the first address in the list will be used. So it is vital in the checkout process to either sort them or just supply one delivery address. Company addresses will override Customer addresses if both exists in the Checkout process.

object <Address> (Address)
UseInvoiceAddressAsDeliveryAddress
boolean

Can be used when updating or inserting addresses on Company. If set to true the invoice address will be used as a delivery address as well. Then just an invoice address needs to be passed in. The deliveryAddress will be ignored. If set to false both invoice address and delivery address must be specified.

Array of objects <IdValue> (IdValue)

Contains a list of id-value pairs specific to the client for this company. Use ApplicationService.ListCompanyInfoTypes for id lookup.

PricelistIds
Array of integers <int32>

Contains a list of priceList ids valid for this company. It will be empty if no priceLists exist. It can be used to check products lists if they are from a company specific priceList. No need to pass this into List-methods since they are considered any way in the methods. This property should be considered as ReadOnly as priceLists are maintained else where.

ParentId
integer or null <int32>

Points to an optional parent company. Used when companies are connected some how.

DeliveryMethodIds
Array of integers <int32>

Contains a list of delivery method ids valid for this company. It will be empty if no delivery methods exist.

PaymentMethodIds
Array of integers <int32>

Contains a list of payment method ids valid for this company. It will be empty if no payment methods exist.

Email
string

The Email address of the Company. MaxLength: 255

Array of objects <Flag> (Flag)

A list of Flags of the Company. See Flag for information about flags. Flags can be used in Promotions or otherwise to provide custom handling of specific Companies.

VatNo
string

This is the VAT registration number for the company. MaxLength: 50

Responses
200

Success

400

Bad Request

Key: CompanyAlreadyExists. Gets raised when there already exists a company with the specified organizational number/name combination.

Key: CustomerMissing. Gets raised if the Customer is missing.

Key: InvalidCompanyName. Gets raised if the Company.Name is missing.

Key: DeliveryAddressZipMissing. Gets raised if any DeliveryAddress is supplied and it is missing a Zip code.

Key: DeliveryAddressCityMissing. Gets raised if any DeliveryAddress is supplied and it is missing a City.

Key: DeliveryAddressCountryMissing. Gets raised if any DeliveryAddress is supplied and it is missing a Country.

Key: InvoiceAddressZipMissing. Gets raised if any DeliveryAddress is supplied and it is missing a Zip code.

Key: InvoiceAddressCityMissing. Gets raised if any DeliveryAddress is supplied and it is missing a City.

Key: InvoiceAddressCountryMissing. Gets raised if any DeliveryAddress is supplied and it is missing a Country.

500

Internal Server Error

post/CustomerService.svc/rest/UpdateCompany
Request samples
{
  • "Id": 0,
  • "Key": "string",
  • "Code": "string",
  • "Name": "string",
  • "OrgNo": "string",
  • "Phone": "string",
  • "ReferId": 0,
  • "ReferUrl": "string",
  • "DeliveryAddresses": [
    ],
  • "InvoiceAddress": {
    },
  • "UseInvoiceAddressAsDeliveryAddress": true,
  • "Info": [
    ],
  • "PricelistIds": [
    ],
  • "ParentId": 0,
  • "DeliveryMethodIds": [
    ],
  • "PaymentMethodIds": [
    ],
  • "Email": "string",
  • "Flags": [
    ],
  • "VatNo": "string"
}
Response samples
{
  • "Id": 0,
  • "Key": "string",
  • "Code": "string",
  • "Email": "string",
  • "SSN": "string",
  • "FirstName": "string",
  • "LastName": "string",
  • "Phone": "string",
  • "CellPhone": "string",
  • "ReferId": 0,
  • "ReferUrl": "string",
  • "Account": {
    },
  • "Companies": [
    ],
  • "DeliveryAddresses": [
    ],
  • "InvoiceAddress": {
    },
  • "Flags": [
    ],
  • "UseInvoiceAddressAsDeliveryAddress": true,
  • "Info": [
    ],
  • "PricelistIds": [
    ],
  • "CrmId": "string",
  • "IsActive": true,
  • "Created": "2019-08-24T14:15:22Z",
  • "Updated": "2019-08-24T14:15:22Z"
}