This method enables the creation of new customers (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.

Request

POST https://gambio-shop.de/shop1/api.php/v2/customers

Request body

Read-only parameters such as a resource's ID field are to be omitted.

The request body takes a GXCustomerArray resource, containing the following writable properties:

[
    {
        "addonValues": null,
        "address": {
            "additionalAddressInfo": "6. Etage",
            "b2bStatus": false,
            "city": "Test City",
            "company": "Test Company",
            "countryId": "81",
            "houseNumber": "5",
            "postcode": "23983",
            "street": "Test Street",
            "suburb": "Test Suburb",
            "zoneId": "1355"
        },
        "dateOfBirth": "1985-02-13",
        "email": "customer@email.de",
        "fax": "2093049283",
        "firstname": "John",
        "gender": "m",
        "isGuest": false,
        "lastname": "Doe",
        "number": "234982739",
        "password": "827ccb0eea8a706c4c34a16891f84e7b",
        "statusId": "1",
        "telephone": "2343948798345",
        "type": "registree",
        "vatNumber": "0923429837942",
        "vatNumberStatus": true
    }
]
[
    {}
]

Properties

Name Type Description Additional

Authorization

In order to provide the authentication, you must insert the Basic Auth inside the HTTP header. The Basic Auth is an encrypted base64 string that holds the following content: admin@shop.de:12345 where the structure is as follows: username:password.

An example header would look as follows:

Authorization: Basic YWRtaW5Ac2hvcC5kZToxMjM0NQ==

This request requires the use of one of following authorisation methods: BASIC .

Response

The following HTTP status codes may be returned, optionally with a response resource.

Status code Description Resource
201 Created

Upon success, returns the customer that was created

customerArrayPostResponse
400 Bad Request

(Customer data missing)

defaultErrorResponse
409 Conflict

(Registree email already exists)

defaultErrorResponse

Example Snippets

Here are some example implementations for this operation.

curl --request POST \
--header 'accept: application/json' \
--header 'authorization: Basic REPLACE_BASIC_AUTH' \
--header 'content-type: application/json' \
--data '[[{"id":0,"number":"","gender":"m","firstname":"","lastname":"","dateOfBirth":"","vatNumber":"","vatNumberStatus":0,"telephone":"","fax":"","email":"","statusId":0,"isGuest":false,"addressId":0,"addonValues":""}]]'
wget --quiet \
--method POST \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'authorization: Basic REPLACE_BASIC_AUTH' \
--body-data '[[{"id":0,"number":"","gender":"m","firstname":"","lastname":"","dateOfBirth":"","vatNumber":"","vatNumberStatus":0,"telephone":"","fax":"","email":"","statusId":0,"isGuest":false,"addressId":0,"addonValues":""}]]' \
--output-document

    echo '[[{"id":0,"number":"","gender":"m","firstname":"","lastname":"","dateOfBirth":"","vatNumber":"","vatNumberStatus":0,"telephone":"","fax":"","email":"","statusId":0,"isGuest":false,"addressId":0,"addonValues":""}]]' | \
    accept:application/json \
    authorization:'Basic REPLACE_BASIC_AUTH' \
    content-type:application/json
    HttpResponse response = Unirest.post("https://gambio-shop.de/shop1/api.php/v2/customers")
    .header("accept", "application/json")
    .header("content-type", "application/json")
    .header("authorization", "Basic REPLACE_BASIC_AUTH")
    .body("[[{\"id\":0,\"number\":\"\",\"gender\":\"m\",\"firstname\":\"\",\"lastname\":\"\",\"dateOfBirth\":\"\",\"vatNumber\":\"\",\"vatNumberStatus\":0,\"telephone\":\"\",\"fax\":\"\",\"email\":\"\",\"statusId\":0,\"isGuest\":false,\"addressId\":0,\"addonValues\":\"\"}]]")
    .asString();
    OkHttpClient client = new OkHttpClient();

    MediaType mediaType = MediaType.parse("application/json");

    RequestBody body = RequestBody.create(mediaType, "[[{\"id\":0,\"number\":\"\",\"gender\":\"m\",\"firstname\":\"\",\"lastname\":\"\",\"dateOfBirth\":\"\",\"vatNumber\":\"\",\"vatNumberStatus\":0,\"telephone\":\"\",\"fax\":\"\",\"email\":\"\",\"statusId\":0,\"isGuest\":false,\"addressId\":0,\"addonValues\":\"\"}]]");
    Request request = new Request.Builder()
    .post(body)
    .addHeader("accept", "application/json")
    .addHeader("content-type", "application/json")
    .addHeader("authorization", "Basic REPLACE_BASIC_AUTH")
    .build();

    Response response = client.newCall(request).execute();

    var request = new RestRequest(Method.POST);
    request.AddHeader("authorization", "Basic REPLACE_BASIC_AUTH");
    request.AddHeader("content-type", "application/json");
    request.AddHeader("accept", "application/json");
    request.AddParameter("application/json", "[[{\"id\":0,\"number\":\"\",\"gender\":\"m\",\"firstname\":\"\",\"lastname\":\"\",\"dateOfBirth\":\"\",\"vatNumber\":\"\",\"vatNumberStatus\":0,\"telephone\":\"\",\"fax\":\"\",\"email\":\"\",\"statusId\":0,\"isGuest\":false,\"addressId\":0,\"addonValues\":\"\"}]]", ParameterType.RequestBody);
    IRestResponse response = client.Execute(request);
    var http = require("https");

    var options = {

    "method": "POST",
    "hostname": "gambio-shop.de",
    "port": null,
    "path": "/shop1/api.php/v2/customers",
    "headers": {

    "accept": "application/json",
    "content-type": "application/json",
    "authorization": "Basic REPLACE_BASIC_AUTH"

    }

    };

    var req = http.request(options, function (res) {

    var chunks = [];

    res.on("data", function (chunk) {

    chunks.push(chunk);

    });

    res.on("end", function () {

    var body = Buffer.concat(chunks);
    console.log(body.toString());

    });

    });

    req.write(JSON.stringify([ [ { id: 0,

      number: '<ADD STRING VALUE>',
    gender: 'm',
    firstname: '<ADD STRING VALUE>',
    lastname: '<ADD STRING VALUE>',
    dateOfBirth: '<ADD STRING VALUE>',
    vatNumber: '<ADD STRING VALUE>',
    vatNumberStatus: 0,
    telephone: '<ADD STRING VALUE>',
    fax: '<ADD STRING VALUE>',
    email: '<ADD STRING VALUE>',
    statusId: 0,
    isGuest: false,
    addressId: 0,
    addonValues: '<ADD STRING VALUE>' } ] ]));

    req.end();

    var request = require("request");

    var options = { method: 'POST',

    headers:
    { authorization: 'Basic REPLACE_BASIC_AUTH',

     'content-type': 'application/json',
    accept: 'application/json' },

    body:

    [ [ { id: 0,

         number: '<ADD STRING VALUE>',
    gender: 'm',
    firstname: '<ADD STRING VALUE>',
    lastname: '<ADD STRING VALUE>',
    dateOfBirth: '<ADD STRING VALUE>',
    vatNumber: '<ADD STRING VALUE>',
    vatNumberStatus: 0,
    telephone: '<ADD STRING VALUE>',
    fax: '<ADD STRING VALUE>',
    email: '<ADD STRING VALUE>',
    statusId: 0,
    isGuest: false,
    addressId: 0,
    addonValues: '<ADD STRING VALUE>' } ] ],

    json: true };

    request(options, function (error, response, body) {

    if (error) throw new Error(error);

    console.log(body);

    });

    var unirest = require("unirest");

    req.headers({

    "authorization": "Basic REPLACE_BASIC_AUTH",
    "content-type": "application/json",
    "accept": "application/json"
    });

    req.type("json");

    req.send([
    [

    {
    "id": 0,
    "number": "<ADD STRING VALUE>",
    "gender": "m",
    "firstname": "<ADD STRING VALUE>",
    "lastname": "<ADD STRING VALUE>",
    "dateOfBirth": "<ADD STRING VALUE>",
    "vatNumber": "<ADD STRING VALUE>",
    "vatNumberStatus": 0,
    "telephone": "<ADD STRING VALUE>",
    "fax": "<ADD STRING VALUE>",
    "email": "<ADD STRING VALUE>",
    "statusId": 0,
    "isGuest": false,
    "addressId": 0,
    "addonValues": "<ADD STRING VALUE>"
    }

    ]

    ]);

    req.end(function (res) {

    if (res.error) throw new Error(res.error);

    console.log(res.body);

    });

    var data = JSON.stringify([
    [

    {
    "id": 0,
    "number": "<ADD STRING VALUE>",
    "gender": "m",
    "firstname": "<ADD STRING VALUE>",
    "lastname": "<ADD STRING VALUE>",
    "dateOfBirth": "<ADD STRING VALUE>",
    "vatNumber": "<ADD STRING VALUE>",
    "vatNumberStatus": 0,
    "telephone": "<ADD STRING VALUE>",
    "fax": "<ADD STRING VALUE>",
    "email": "<ADD STRING VALUE>",
    "statusId": 0,
    "isGuest": false,
    "addressId": 0,
    "addonValues": "<ADD STRING VALUE>"
    }

    ]

    ]);

    var xhr = new XMLHttpRequest();

    xhr.withCredentials = true;

    xhr.addEventListener("readystatechange", function () {

    if (this.readyState === this.DONE) {

    console.log(this.responseText);

    }

    });

    xhr.setRequestHeader("accept", "application/json");
    xhr.setRequestHeader("content-type", "application/json");
    xhr.setRequestHeader("authorization", "Basic REPLACE_BASIC_AUTH");

    xhr.send(data);

    var settings = {
    "async": true,
    "crossDomain": true,
    "method": "POST",
    "headers": {

    "accept": "application/json",
    "content-type": "application/json",
    "authorization": "Basic REPLACE_BASIC_AUTH"

    },

    "processData": false,
    "data": "[[{\"id\":0,\"number\":\"\",\"gender\":\"m\",\"firstname\":\"\",\"lastname\":\"\",\"dateOfBirth\":\"\",\"vatNumber\":\"\",\"vatNumberStatus\":0,\"telephone\":\"\",\"fax\":\"\",\"email\":\"\",\"statusId\":0,\"isGuest\":false,\"addressId\":0,\"addonValues\":\"\"}]]"
    }

    $.ajax(settings).done(function (response) {

    console.log(response);
    });

    <?php

    $curl = curl_init();

    curl_setopt_array($curl, array(

    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => "[[{\"id\":0,\"number\":\"\",\"gender\":\"m\",\"firstname\":\"\",\"lastname\":\"\",\"dateOfBirth\":\"\",\"vatNumber\":\"\",\"vatNumberStatus\":0,\"telephone\":\"\",\"fax\":\"\",\"email\":\"\",\"statusId\":0,\"isGuest\":false,\"addressId\":0,\"addonValues\":\"\"}]]",
    CURLOPT_HTTPHEADER => array(

    "accept: application/json",
    "authorization: Basic REPLACE_BASIC_AUTH",
    "content-type: application/json"

    ),

    ));

    $response = curl_exec($curl);

    $err = curl_error($curl);

    curl_close($curl);

    if ($err) {

    echo "cURL Error #:" . $err;
    } else {
    echo $response;
    }

    <?php

    $request = new HttpRequest();

    $request->setMethod(HTTP_METH_POST);

    $request->setHeaders(array(

    'authorization' => 'Basic REPLACE_BASIC_AUTH',
    'content-type' => 'application/json',
    'accept' => 'application/json'
    ));

    $request->setBody('[[{"id":0,"number":"","gender":"m","firstname":"","lastname":"","dateOfBirth":"","vatNumber":"","vatNumberStatus":0,"telephone":"","fax":"","email":"","statusId":0,"isGuest":false,"addressId":0,"addonValues":""}]]');

    try {

    $response = $request->send();

    echo $response->getBody();

    } catch (HttpException $ex) {
    echo $ex;
    }

    <?php

    $client = new http\Client;

    $request = new http\Client\Request;

    $body = new http\Message\Body;

    $body->append('[[{"id":0,"number":"","gender":"m","firstname":"","lastname":"","dateOfBirth":"","vatNumber":"","vatNumberStatus":0,"telephone":"","fax":"","email":"","statusId":0,"isGuest":false,"addressId":0,"addonValues":""}]]');

    $request->setRequestMethod('POST');
    $request->setBody($body);

    $request->setHeaders(array(

    'authorization' => 'Basic REPLACE_BASIC_AUTH',
    'content-type' => 'application/json',
    'accept' => 'application/json'
    ));

    $client->enqueue($request)->send();

    $response = $client->getResponse();

    echo $response->getBody();

    import http.client

    conn = http.client.HTTPSConnection("gambio-shop.de")

    payload = "[[{\"id\":0,\"number\":\"\",\"gender\":\"m\",\"firstname\":\"\",\"lastname\":\"\",\"dateOfBirth\":\"\",\"vatNumber\":\"\",\"vatNumberStatus\":0,\"telephone\":\"\",\"fax\":\"\",\"email\":\"\",\"statusId\":0,\"isGuest\":false,\"addressId\":0,\"addonValues\":\"\"}]]"

    headers = {

    'accept': "application/json",
    'content-type': "application/json",
    'authorization': "Basic REPLACE_BASIC_AUTH"
    }

    conn.request("POST", "/shop1/api.php/v2/customers", payload, headers)

    res = conn.getresponse()

    data = res.read()

    print(data.decode("utf-8"))

    import requests

    payload = "[[{\"id\":0,\"number\":\"\",\"gender\":\"m\",\"firstname\":\"\",\"lastname\":\"\",\"dateOfBirth\":\"\",\"vatNumber\":\"\",\"vatNumberStatus\":0,\"telephone\":\"\",\"fax\":\"\",\"email\":\"\",\"statusId\":0,\"isGuest\":false,\"addressId\":0,\"addonValues\":\"\"}]]"

    headers = {

    'accept': "application/json",
    'content-type': "application/json",
    'authorization': "Basic REPLACE_BASIC_AUTH"
    }

    response = requests.request("POST", url, data=payload, headers=headers)

    print(response.text)

    require 'uri'
    require 'net/http'

    http = Net::HTTP.new(url.host, url.port)

    http.use_ssl = true
    http.verify_mode = OpenSSL::SSL::VERIFY_NONE

    request = Net::HTTP::Post.new(url)

    request["accept"] = 'application/json'
    request["content-type"] = 'application/json'
    request["authorization"] = 'Basic REPLACE_BASIC_AUTH'
    request.body = "[[{\"id\":0,\"number\":\"\",\"gender\":\"m\",\"firstname\":\"\",\"lastname\":\"\",\"dateOfBirth\":\"\",\"vatNumber\":\"\",\"vatNumberStatus\":0,\"telephone\":\"\",\"fax\":\"\",\"email\":\"\",\"statusId\":0,\"isGuest\":false,\"addressId\":0,\"addonValues\":\"\"}]]"

    response = http.request(request)

    puts response.read_body

    CURL *hnd = curl_easy_init();

    curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");

    curl_easy_setopt(hnd, CURLOPT_URL, "https://gambio-shop.de/shop1/api.php/v2/customers");

    struct curl_slist *headers = NULL;

    headers = curl_slist_append(headers, "authorization: Basic REPLACE_BASIC_AUTH");
    headers = curl_slist_append(headers, "content-type: application/json");
    headers = curl_slist_append(headers, "accept: application/json");
    curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

    curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "[[{\"id\":0,\"number\":\"\",\"gender\":\"m\",\"firstname\":\"\",\"lastname\":\"\",\"dateOfBirth\":\"\",\"vatNumber\":\"\",\"vatNumberStatus\":0,\"telephone\":\"\",\"fax\":\"\",\"email\":\"\",\"statusId\":0,\"isGuest\":false,\"addressId\":0,\"addonValues\":\"\"}]]");

    CURLcode ret = curl_easy_perform(hnd);

    package main

    import (

    "fmt"
    "strings"
    "net/http"
    "io/ioutil"

    )

    func main() {

    url := "https://gambio-shop.de/shop1/api.php/v2/customers"
    payload := strings.NewReader("[[{\"id\":0,\"number\":\"<ADD STRING VALUE>\",\"gender\":\"m\",\"firstname\":\"<ADD STRING VALUE>\",\"lastname\":\"<ADD STRING VALUE>\",\"dateOfBirth\":\"<ADD STRING VALUE>\",\"vatNumber\":\"<ADD STRING VALUE>\",\"vatNumberStatus\":0,\"telephone\":\"<ADD STRING VALUE>\",\"fax\":\"<ADD STRING VALUE>\",\"email\":\"<ADD STRING VALUE>\",\"statusId\":0,\"isGuest\":false,\"addressId\":0,\"addonValues\":\"<ADD STRING VALUE>\"}]]")
    req, _ := http.NewRequest("POST", url, payload)
    req.Header.Add("accept", "application/json")
    req.Header.Add("content-type", "application/json")
    req.Header.Add("authorization", "Basic REPLACE_BASIC_AUTH")
    res, _ := http.DefaultClient.Do(req)
    defer res.Body.Close()
    body, _ := ioutil.ReadAll(res.Body)
    fmt.Println(res)
    fmt.Println(string(body))

    }

    #import

    NSDictionary *headers = @{ @"accept": @"application/json",

                           @"content-type": @"application/json",
    @"authorization": @"Basic REPLACE_BASIC_AUTH" };

    NSDictionary *parameters = @[ @[ @{ @"id": @0, @"number": @"", @"gender": @"m", @"firstname": @"", @"lastname": @"", @"dateOfBirth": @"", @"vatNumber": @"", @"vatNumberStatus": @0, @"telephone": @"", @"fax": @"", @"email": @"", @"statusId": @0, @"isGuest": @NO, @"addressId": @0, @"addonValues": @"" } ] ];

    NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];

    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://gambio-shop.de/shop1/api.php/v2/customers"]

                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy
    timeoutInterval:10.0];

    [request setHTTPMethod:@"POST"];

    [request setAllHTTPHeaderFields:headers];
    [request setHTTPBody:postData];

    NSURLSession *session = [NSURLSession sharedSession];

    NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request

                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
    if (error) {
    NSLog(@"%@", error);
    } else {
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
    NSLog(@"%@", httpResponse);
    }
    }];

    [dataTask resume];

    import Foundation

    let headers = [

    "accept": "application/json",
    "content-type": "application/json",
    "authorization": "Basic REPLACE_BASIC_AUTH"
    ]
    let parameters = [[

    [
    "id": 0,
    "number": "<ADD STRING VALUE>",
    "gender": "m",
    "firstname": "<ADD STRING VALUE>",
    "lastname": "<ADD STRING VALUE>",
    "dateOfBirth": "<ADD STRING VALUE>",
    "vatNumber": "<ADD STRING VALUE>",
    "vatNumberStatus": 0,
    "telephone": "<ADD STRING VALUE>",
    "fax": "<ADD STRING VALUE>",
    "email": "<ADD STRING VALUE>",
    "statusId": 0,
    "isGuest": false,
    "addressId": 0,
    "addonValues": "<ADD STRING VALUE>"
    ]

    ]]

    let postData = NSJSONSerialization.dataWithJSONObject(parameters, options: nil, error: nil)

    var request = NSMutableURLRequest(URL: NSURL(string: "https://gambio-shop.de/shop1/api.php/v2/customers")!,

                                        cachePolicy: .UseProtocolCachePolicy,
    timeoutInterval: 10.0)

    request.HTTPMethod = "POST"

    request.allHTTPHeaderFields = headers
    request.HTTPBody = postData

    let session = NSURLSession.sharedSession()

    let dataTask = session.dataTaskWithRequest(request, completionHandler: { (data, response, error) -> Void in
    if (error != nil) {

    println(error)

    } else {

    let httpResponse = response as? NSHTTPURLResponse
    println(httpResponse)

    }

    })

    dataTask.resume()

    open Cohttp_lwt_unix
    open Cohttp
    open Lwt

    let headers = Header.add_list (Header.init ()) [
    ("accept", "application/json");
    ("content-type", "application/json");
    ("authorization", "Basic REPLACE_BASIC_AUTH");
    ] in
    let body = Cohttp_lwt_body.of_string "[[{\"id\":0,\"number\":\"\",\"gender\":\"m\",\"firstname\":\"\",\"lastname\":\"\",\"dateOfBirth\":\"\",\"vatNumber\":\"\",\"vatNumberStatus\":0,\"telephone\":\"\",\"fax\":\"\",\"email\":\"\",\"statusId\":0,\"isGuest\":false,\"addressId\":0,\"addonValues\":\"\"}]]" in

    Client.call ~headers ~body `POST uri

    = fun (res, body_stream) ->

    (* Do stuff with the result *)