Creates a customer account.
| arg | required? | syntax | info |
|---|---|---|---|
parentID | N | posint | custID of account that is to be the parent account for the new customer (defaults to the account you used for the API login) |
accountname | Y | string | legal trading name for this account. Usually the same as the contact orgname (if it exists) or else the name |
contact | Y | array | sub array containing primary contact information |
source | N | string | information only; where the customer came from (eg "google") |
username | N | string | Customer's username |
password | Y | string | Customer's password |
secretquestion | N | string | Customer's chosen security question |
secretanswer | N | string | Answer to customer's chosen security question |
custof | Y | list:(company keywords) | billcomp list |
ok_to_contact | N | boolean | Defines whether it is OK to send correspondance to the customer; default=1 |
ok_to_newsletter | N | boolean | Defines whether it is OK to send newsletters to the customer; default=1 |
This field is the main trading name/legal entity for the account. If the customer is a business, this will be the business name. If the customer is opening an account for their own personal use, this field should contain their name.
A sub-array containing contact information. This sub-array is fed into the contact.create function. For a full list of arguments, read the documentation on that function.
You do not need to specify the owner_custID element of this array because the cust.create does this for you.
This is the username that a customer will later be able to use to log in to their account. It must be system-unique. If you omit this field, the username will default to matching their account number.
Customers can choose a security question to record against their account. This is useful if they call us up having forgotten their password because we can use the secret question and answer to verify their identity. The question should relate to something that the customer finds easy to remember but is hard for someone else to guess. Avoid questions that have a limited number of possible answers such as a favourite colour, or questions that have yes/no answers.
An array or comma separated list of billcomp (supplier company) keywords. The list should include every supplier group company that is going to supply goods and services to this customer.
For a list of billcomps available, see the billing_companies element returned by the API login process for the parent API account. This contains a list of billcomps. The array is keyed by the billcomp keyword.
If this argument is set to true (it is by default) then we may contact the customer directly on occasion. Normally you would set this to 0 (false) if for some reason we were not to do this (eg if someone referred the customer to us but wanted all customer correspondance to go via themselves)
If this argument is set to true (it is by default) then we may occasionally send promotional newsletters to the customer. If you have a signup form that offers the customer to opt out of receiving newsletters, you may want to set this field to zero if the customer has chosen to opt out.
Create an account for Derby Dumpvalves Ltd and set up the account to work with skycom and centralindex.
Perl example request:
POST https://live.apicontrol.co.uk/1/json
my %args =
(
'parentID' => ,
'accountname' => 'Derby Dumpvalves Ltd',
'password' => 'wedkjn3439',
'custof' => 'centralindex,skycom',
'ok_to_contact' => 1,
'ok_to_newsletter' => 1,
'secretquestion' => 'What does your neighbour have in his back garden?',
'secretanswer' => 'A pink steamroller',
'contact' =>
{
'title' => 'Mr',
'fname' => 'Fred',
'lname' => 'Aichison',
'addr1' => '73 Springforth Road',
'town' => 'Derby',
'county' => 'Derbyshire',
'postcode' => 'D12 8QT',
'countrycode' => 'UK',
'phone' => '08451212121',
'interphone' => '+44.8451212121',
'phone_times' => 'daytime',
'fax' => '08452121212',
'interfax' => '+44.8452121212',
'fax_times' => '24/7',
'email' => 'fred@derbydumpvalves.co.uk',
},
);
my $res = $api->cust_create(%args);XML example request:
POST https://live.apicontrol.co.uk/1/json
In this example, the response indicates that the new account ID (custID) is 29929. Because we didn't supply a username, the username has also been set to '29929'.
Perl example response:
{
'success' => '1',
'questionID' => '24',
'errordiags' => '',
'username' => '29929',
'numadded' => '1',
'sc_accountID' => '11100',
'error' => undef,
'errornum' => '',
'custID' => '29929',
'contactID' => '14549',
'results' => []
};XML example response: