Zum Hauptinhalt springen

Create a new customer profile

POST/v2/customers
API-Version
v2
Request-Methode
POST
Operation-ID
customer-create-customer

Request​

Responses​

Format
application/json
Beschreibung

The new customer

  • customerIdstringrequired
  • customerNumberstringrequired
  • namestring (≤ 80 Zeichen)required
Content-Type: application/json

{
"customerId": "string",
"customerNumber": "string",
"name": "string"
}
{
"properties": {
"customerId": {
"type": "string"
},
"customerNumber": {
"type": "string"
},
"name": {
"maxLength": 80,
"type": "string"
}
},
"required": [
"customerId",
"name",
"customerNumber"
],
"type": "object"
}

Nutzungsbeispiele​

$ curl \
--fail \
--location \
-X POST \
-d '{"name":"string","owner":{"address":{"street":"Königsberger Straße","houseNumber":"4-6","city":"Espelkamp","zip":"32339","countryCode":"DE","addressPrefix":"c/o Ada Lovelace"},"company":"string","emailAddress":"email@mittwald.example","firstName":"string","lastName":"string","leitwegId":"string","phoneNumbers":["string"],"purchaseOrderReference":"string","salutation":"mr","title":"string","useFormalTerm":true},"vatId":"string"}' \
-H "Authorization: Bearer $MITTWALD_API_TOKEN" \
-H 'Content-Type: application/json' \
https://api.mittwald.de/v2/customers
import { MittwaldAPIV2Client } from "@mittwald/api-client";
import { assertStatus } from "@mittwald/api-client-commons";

const client = MittwaldAPIClient.newWithToken(process.env.MITTWALD_API_TOKEN);
const response = await client.customer.createCustomer({
"data": {
"name": "string",
"owner": {
"address": {
"street": "Königsberger Straße",
"houseNumber": "4-6",
"city": "Espelkamp",
"zip": "32339",
"countryCode": "DE",
"addressPrefix": "c/o Ada Lovelace"
},
"company": "string",
"emailAddress": "email@mittwald.example",
"firstName": "string",
"lastName": "string",
"leitwegId": "string",
"phoneNumbers": [
"string"
],
"purchaseOrderReference": "string",
"salutation": "mr",
"title": "string",
"useFormalTerm": true
},
"vatId": "string"
}
});

assertStatus(response, 201);

use \Mittwald\ApiClient\Generated\V2\Clients\Customer\CreateCustomer\CreateCustomerRequest;
use \Mittwald\ApiClient\Generated\V2\Clients\Customer\CreateCustomer\CreateCustomerRequestBody;

$client = MittwaldAPIClient::newWithToken(getenv('MITTWALD_API_TOKEN'));

// TODO: Please consult the properties and constructor signature of
// CreateCustomerRequestBody to learn how to construct a valid instance
$body = new CreateCustomerRequestBody(/* TODO: ... */);

$request = (new CreateCustomerRequest(
body: $body
));
$response = $client->customer()->createCustomer($request);

var_dump($response->getBody();

Auf dieser Seite