Create an address record for a customer in the system.
POST https://gambio-shop.de/shop1/api.php/v2/addresses
Read-only parameters such as a resource's ID field are to be omitted.
The request body takes a GXAddress resource, containing the following writable properties:
{
"additionalAddressInfo": "1. Etage",
"b2bStatus": false,
"city": "Test City",
"class": null,
"company": "Test Company",
"countryId": 81,
"customerId": 1,
"firstname": "John",
"gender": "m",
"houseNumber": "123",
"lastname": "Doe",
"postcode": "23983",
"street": "Test Street",
"suburb": "Test Suburb",
"zoneId": 84
}
{
"additionalAddressInfo": "string",
"b2bStatus": "boolean",
"city": "string",
"class": "string",
"company": "string",
"countryId": "int64",
"customerId": "int64",
"firstname": "string",
"gender": "string",
"houseNumber": "string",
"lastname": "string",
"postcode": "string",
"street": "string",
"suburb": "string",
"zoneId": "int64"
}
Name | Type | Description | Additional |
---|---|---|---|
additionalAddressInfo | string | Required | |
b2bStatus | boolean | Required | |
city | string | Required | |
class | string | Required | |
company | string | Required | |
countryId | int64 | Required | |
customerId | int64 | Required | |
firstname | string | Required | |
gender | string |
Possible values are:
|
Required |
houseNumber | string | Required | |
lastname | string | Required | |
postcode | string | Required | |
street | string | Required | |
suburb | string | Required | |
zoneId | int64 | Required |
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
.
The following HTTP status codes may be returned, optionally with a response resource.
Status code | Description | Resource |
---|---|---|
200 | OK Upon success, returns the newly created address |
GXCustomer |
400 | Bad Request (Address data was not provided) |
defaultErrorResponse |
Here are some example implementations for this operation.
MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, "{\"id\":0,\"customerId\":0,\"gender\":\"m\",\"company\":\"\",\"firstname\":\"\",\"lastname\":\"\",\"street\":\"\",\"houseNumber\":\"\",\"additionalAddressInfo\":\"\",\"suburb\":\"\",\"postcode\":\"\",\"city\":\"\",\"countryId\":0,\"zoneId\":0,\"class\":\"\",\"b2bStatus\":false}"); Request request = new Request.Builder() .url("https://gambio-shop.de/shop1/api.php/v2/addresses") .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 options = { "method": "POST", "hostname": "gambio-shop.de", "port": null, "path": "/shop1/api.php/v2/addresses", "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, customerId: 0, gender: 'm', company: '', firstname: '', lastname: '', street: '', houseNumber: '', additionalAddressInfo: '', suburb: '', postcode: '', city: '', countryId: 0, zoneId: 0, class: '', b2bStatus: false })); req.end();
var options = { method: 'POST', url: 'https://gambio-shop.de/shop1/api.php/v2/addresses', headers: {
accept: 'application/json',
'content-type': 'application/json',
authorization: 'Basic REPLACE_BASIC_AUTH'
}, body: {
id: 0,
customerId: 0,
gender: 'm',
company: '<ADD STRING VALUE>',
firstname: '<ADD STRING VALUE>',
lastname: '<ADD STRING VALUE>',
street: '<ADD STRING VALUE>',
houseNumber: '<ADD STRING VALUE>',
additionalAddressInfo: '<ADD STRING VALUE>',
suburb: '<ADD STRING VALUE>',
postcode: '<ADD STRING VALUE>',
city: '<ADD STRING VALUE>',
countryId: 0,
zoneId: 0,
class: '<ADD STRING VALUE>',
b2bStatus: false
}, json: true };
request(options, function (error, response, body) { if (error) throw new Error(error);
console.log(body); });
var req = unirest("POST", "https://gambio-shop.de/shop1/api.php/v2/addresses");
req.headers({ "accept": "application/json", "content-type": "application/json", "authorization": "Basic REPLACE_BASIC_AUTH" });
req.type("json"); req.send({ "id": 0, "customerId": 0, "gender": "m", "company": "", "firstname": "", "lastname": "", "street": "", "houseNumber": "", "additionalAddressInfo": "", "suburb": "", "postcode": "", "city": "", "countryId": 0, "zoneId": 0, "class": "", "b2bStatus": false });
req.end(function (res) { if (res.error) throw new Error(res.error);
console.log(res.body); });
var xhr = new XMLHttpRequest(); xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () { if (this.readyState === this.DONE) {
console.log(this.responseText);
} });
xhr.open("POST", "https://gambio-shop.de/shop1/api.php/v2/addresses"); xhr.setRequestHeader("accept", "application/json"); xhr.setRequestHeader("content-type", "application/json"); xhr.setRequestHeader("authorization", "Basic REPLACE_BASIC_AUTH");
xhr.send(data);
"accept": "application/json",
"content-type": "application/json",
"authorization": "Basic REPLACE_BASIC_AUTH"
}, "processData": false, "data": "{\"id\":0,\"customerId\":0,\"gender\":\"m\",\"company\":\"\",\"firstname\":\"\",\"lastname\":\"\",\"street\":\"\",\"houseNumber\":\"\",\"additionalAddressInfo\":\"\",\"suburb\":\"\",\"postcode\":\"\",\"city\":\"\",\"countryId\":0,\"zoneId\":0,\"class\":\"\",\"b2bStatus\":false}" }
$.ajax(settings).done(function (response) { console.log(response); });
$curl = curl_init();
curl_setopt_array($curl, array( CURLOPT_URL => "https://gambio-shop.de/shop1/api.php/v2/addresses", 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,\"customerId\":0,\"gender\":\"m\",\"company\":\"\",\"firstname\":\"\",\"lastname\":\"\",\"street\":\"\",\"houseNumber\":\"\",\"additionalAddressInfo\":\"\",\"suburb\":\"\",\"postcode\":\"\",\"city\":\"\",\"countryId\":0,\"zoneId\":0,\"class\":\"\",\"b2bStatus\":false}", 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; }
$request = new HttpRequest(); $request->setUrl('https://gambio-shop.de/shop1/api.php/v2/addresses'); $request->setMethod(HTTP_METH_POST);
$request->setHeaders(array( 'accept' => 'application/json', 'content-type' => 'application/json', 'authorization' => 'Basic REPLACE_BASIC_AUTH' ));
$request->setBody('{"id":0,"customerId":0,"gender":"m","company":"","firstname":"","lastname":"","street":"","houseNumber":"","additionalAddressInfo":"","suburb":"","postcode":"","city":"","countryId":0,"zoneId":0,"class":"","b2bStatus":false}');
try { $response = $request->send();
echo $response->getBody(); } catch (HttpException $ex) { echo $ex; }
$client = new http\Client; $request = new http\Client\Request;
$body = new http\Message\Body; $body->append('{"id":0,"customerId":0,"gender":"m","company":"","firstname":"","lastname":"","street":"","houseNumber":"","additionalAddressInfo":"","suburb":"","postcode":"","city":"","countryId":0,"zoneId":0,"class":"","b2bStatus":false}');
$request->setRequestUrl('https://gambio-shop.de/shop1/api.php/v2/addresses'); $request->setRequestMethod('POST'); $request->setBody($body);
$request->setHeaders(array( 'accept' => 'application/json', 'content-type' => 'application/json', 'authorization' => 'Basic REPLACE_BASIC_AUTH' ));
$client->enqueue($request)->send(); $response = $client->getResponse();
echo $response->getBody();
conn = http.client.HTTPSConnection("gambio-shop.de")
payload = "{\"id\":0,\"customerId\":0,\"gender\":\"m\",\"company\":\"\",\"firstname\":\"\",\"lastname\":\"\",\"street\":\"\",\"houseNumber\":\"\",\"additionalAddressInfo\":\"\",\"suburb\":\"\",\"postcode\":\"\",\"city\":\"\",\"countryId\":0,\"zoneId\":0,\"class\":\"\",\"b2bStatus\":false}"
headers = {
'accept': "application/json",
'content-type': "application/json",
'authorization': "Basic REPLACE_BASIC_AUTH"
}
conn.request("POST", "/shop1/api.php/v2/addresses", payload, headers)
res = conn.getresponse() data = res.read()
print(data.decode("utf-8"))
url = "https://gambio-shop.de/shop1/api.php/v2/addresses"
payload = "{\"id\":0,\"customerId\":0,\"gender\":\"m\",\"company\":\"\",\"firstname\":\"\",\"lastname\":\"\",\"street\":\"\",\"houseNumber\":\"\",\"additionalAddressInfo\":\"\",\"suburb\":\"\",\"postcode\":\"\",\"city\":\"\",\"countryId\":0,\"zoneId\":0,\"class\":\"\",\"b2bStatus\":false}" 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)
url = URI("https://gambio-shop.de/shop1/api.php/v2/addresses")
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,\"customerId\":0,\"gender\":\"m\",\"company\":\"\",\"firstname\":\"\",\"lastname\":\"\",\"street\":\"\",\"houseNumber\":\"\",\"additionalAddressInfo\":\"\",\"suburb\":\"\",\"postcode\":\"\",\"city\":\"\",\"countryId\":0,\"zoneId\":0,\"class\":\"\",\"b2bStatus\":false}"
response = http.request(request) puts response.read_body
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST"); curl_easy_setopt(hnd, CURLOPT_URL, "https://gambio-shop.de/shop1/api.php/v2/addresses");
struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "accept: application/json"); headers = curl_slist_append(headers, "content-type: application/json"); headers = curl_slist_append(headers, "authorization: Basic REPLACE_BASIC_AUTH"); curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\"id\":0,\"customerId\":0,\"gender\":\"m\",\"company\":\"\",\"firstname\":\"\",\"lastname\":\"\",\"street\":\"\",\"houseNumber\":\"\",\"additionalAddressInfo\":\"\",\"suburb\":\"\",\"postcode\":\"\",\"city\":\"\",\"countryId\":0,\"zoneId\":0,\"class\":\"\",\"b2bStatus\":false}");
CURLcode ret = curl_easy_perform(hnd);
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://gambio-shop.de/shop1/api.php/v2/addresses"
payload := strings.NewReader("{\"id\":0,\"customerId\":0,\"gender\":\"m\",\"company\":\"<ADD STRING VALUE>\",\"firstname\":\"<ADD STRING VALUE>\",\"lastname\":\"<ADD STRING VALUE>\",\"street\":\"<ADD STRING VALUE>\",\"houseNumber\":\"<ADD STRING VALUE>\",\"additionalAddressInfo\":\"<ADD STRING VALUE>\",\"suburb\":\"<ADD STRING VALUE>\",\"postcode\":\"<ADD STRING VALUE>\",\"city\":\"<ADD STRING VALUE>\",\"countryId\":0,\"zoneId\":0,\"class\":\"<ADD STRING VALUE>\",\"b2bStatus\":false}")
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))
}
NSDictionary *headers = @{ @"accept": @"application/json",
@"content-type": @"application/json",
@"authorization": @"Basic REPLACE_BASIC_AUTH" };
NSDictionary *parameters = @{ @"id": @0,
@"customerId": @0,
@"gender": @"m",
@"company": @"<ADD STRING VALUE>",
@"firstname": @"<ADD STRING VALUE>",
@"lastname": @"<ADD STRING VALUE>",
@"street": @"<ADD STRING VALUE>",
@"houseNumber": @"<ADD STRING VALUE>",
@"additionalAddressInfo": @"<ADD STRING VALUE>",
@"suburb": @"<ADD STRING VALUE>",
@"postcode": @"<ADD STRING VALUE>",
@"city": @"<ADD STRING VALUE>",
@"countryId": @0,
@"zoneId": @0,
@"class": @"<ADD STRING VALUE>",
@"b2bStatus": @NO };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://gambio-shop.de/shop1/api.php/v2/addresses"]
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];
let headers = [ "accept": "application/json", "content-type": "application/json", "authorization": "Basic REPLACE_BASIC_AUTH" ] let parameters = [ "id": 0, "customerId": 0, "gender": "m", "company": "", "firstname": "", "lastname": "", "street": "", "houseNumber": "", "additionalAddressInfo": "", "suburb": "", "postcode": "", "city": "", "countryId": 0, "zoneId": 0, "class": "", "b2bStatus": false ] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "https://gambio-shop.de/shop1/api.php/v2/addresses")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data
let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) {
print(error)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
} })
dataTask.resume()
let uri = Uri.of_string "https://gambio-shop.de/shop1/api.php/v2/addresses" in 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,\"customerId\":0,\"gender\":\"m\",\"company\":\"\",\"firstname\":\"\",\"lastname\":\"\",\"street\":\"\",\"houseNumber\":\"\",\"additionalAddressInfo\":\"\",\"suburb\":\"\",\"postcode\":\"\",\"city\":\"\",\"countryId\":0,\"zoneId\":0,\"class\":\"\",\"b2bStatus\":false}" in
Client.call ~headers ~body `POST uri
= fun (res, body_stream) -> (* Do stuff with the result *)