public
|
#
post( )
Api
{post} /customers Create Customer
Apidescription
This method enables the creation of a new customer (whether registree or a guest). Additionally
the user can provide new address information or just set the id of an existing one. Check the
examples bellow. An example script to demonstrate the creation of a new customer is located under
./docs/REST/samples/customer-service/create_account.php in the git clone, another one to demonstrate the
creation of a guest customer is located under ./docs/REST/samples/customer-service/create_guest_account.php .
Apierror
409-Conflict The API will return this status code if the customer's email already exists in the
database (only applies on registree records).
Apigroup
Customers
Apiname
CreateCustomer
Apiparam
{string} gender Customer's gender, provide "m" for male and "f" for female.
{string} firstname Customer's first name.
{string} lastname Customer's last name.
{string} dateOfBirth Customer's date of birth in "yyyy-mm-dd" format.
{string} vatNumber Valid customer VAT number.
{string} telephone Customer's telephone number.
{string} fax Customer's fax number.
{string} email Valid email address for the customer.
{string} password (Optional) Customer's password, only registree records need this value.
{bool} isGuest Customer's record type, whether true if guest or false if not.
{int} addressId Provide a record ID if the address already exist in the database (otherwise omit this
property).
{object} address (Optional) Contains the customer's address data, can be omitted if the "addressId" is
provided.
{string} address.company Customer's company name.
{string} street The address street.
{string} houseNumber The address house number.
{string} additionalAddressInfo Additional information about the address.
{string} address.suburb Customer's suburb.
{string} address.postcode Customer's postcode.
{string} address.city Customer's city.
{int} address.countryId Must be a country ID registered in the shop database.
{int} address.zoneId The country zone ID, as registered in the shop database.
{Object} addonValues Contains some extra addon values.
Apiparamexample
{json} Registree (New Address)
{
"gender": "m",
"firstname": "John",
"lastname": "Doe",
"dateOfBirth": "1985-02-13",
"vatNumber": "0923429837942",
"telephone": "2343948798345",
"fax": "2093049283",
"email": "customer@email.de",
"password": "0123456789",
"isGuest": false,
"address": {
"company": "Test Company",
"street": "Test Street",
"houseNumber": "123",
"additionalAddressInfo": "1. Etage",
"suburb": "Test Suburb",
"postcode": "23983",
"city": "Test City",
"countryId": 81,
"zoneId": 84,
"b2bStatus": true
},
"addonValues": {
"test_key": "test_value"
}
}
{json} Registree (Existing Address)
{
"gender": "m",
"firstname": "John",
"lastname": "Doe",
"dateOfBirth": "1985-02-13",
"vatNumber": "0923429837942",
"telephone": "2343948798345",
"fax": "2093049283",
"email": "customer@email.de",
"password": "0123456789",
"isGuest": false,
"addressId": 57,
"addonValues": {
"test_key": "test_value"
}
}
{json} Guest (New Address)
{
"gender": "m",
"firstname": "John",
"lastname": "Doe",
"dateOfBirth": "1985-02-13",
"vatNumber": "0923429837942",
"telephone": "2343948798345",
"fax": "2093049283",
"email": "customer@email.de",
"isGuest": true,
"address": {
"company": "Test Company",
"street": "Test Street",
"houseNumber": "123",
"additionalAddressInfo": "1. Etage",
"suburb": "Test Suburb",
"postcode": "23983",
"city": "Test City",
"countryId": 81,
"zoneId": 84,
"b2bStatus": false
},
"addonValues": {
"test_key": "test_value"
}
}
{json} Guest (Existing Address)
{
"gender": "m",
"firstname": "John",
"lastname": "Doe",
"dateOfBirth": "1985-02-13",
"vatNumber": "0923429837942",
"telephone": "2343948798345",
"fax": "2093049283",
"email": "customer@email.de",
"isGuest": true,
"addressId": 57,
"addonValues": {
"test_key": "test_value
}
}
Apisuccess
(Success 201) Response-Body If successful, this method returns a complete Customers resource in the
response body.
Apiversion
2.3.0
|
public
|
#
put( )
Api
{put} /customers/:id Update Customer
Apidescription
This method will update the information of an existing customer record. You will
need to provide all the customer information with the request (except from password
and customer id). Also note that you only have to include the "addressId" property.
An example script to demonstrate how to update the admin accounts telephone number
is located under ./docs/REST/samples/customer-service/update_admin_telephone.php
in the git clone.
Apierror
400-BadRequest Customer record ID was not provided or is invalid.
400-BadRequest Customer data were not provided.
404-NotFound Customer record was not found.
409-Conflict The API will return this status code if the customer's email already exists in the
database (only applies on registree records).
Apigroup
Customers
Apiname
UpdateCustomer
Apiparamexample
{json} Request-Body (Registree)
{
"number": "234982739",
"gender": "m",
"firstname": "John",
"lastname": "Doe",
"dateOfBirth": "1985-02-13",
"vatNumber": "0923429837942",
"vatNumberStatus": 0,
"telephone": "2343948798345",
"fax": "2093049283",
"email": "customer@email.de",
"statusId": 2,
"isGuest": false,
"addressId": 54,
"addonValues": {
"test_key": "test_value-UPDATED"
}
}
{json} Request-Body (Guest)
{
"number": "234982739",
"gender": "m",
"firstname": "John",
"lastname": "Doe",
"dateOfBirth": "1985-02-13",
"vatNumber": "0923429837942",
"vatNumberStatus": true,
"telephone": "2343948798345",
"fax": "2093049283",
"email": "customer@email.de",
"statusId": 1,
"isGuest": true,
"addressId": 98,
"addonValues": {
"test_key": "test_value-UPDATED"
}
}
Apisuccess
Response-Body If successful, this method returns the updated customer resource in the response body.
Apiversion
2.3.0
|