Hi,
ich hätte da ein Warenwirtschaftssystem (gefühlt aus den 80er Jahren) mit >18k Kunden, bei dem ich die Kunden wenigsten über REST abfragen kann.
Jetzt will ich mir über die REST-API /customer (POST,Create a new Customer resources) von Shopware 6 selbst einen importer schreiben. Dazu einige Fragen zum vorgehen:
-
Wer bestimmt die id des Benutzer (hier im Bsp “4f0…ed9”), wo bekomme ich die her?
-
Wo kommt die defaultBillingAddressId, defaultShippingAddressId her (bei dem REST-Endpunkt zum Adresse anlegen selbst muss ja die Customer-ID mitgegeben werden, die ich zu diesem Zeitpunkt noch nicht habe). Wie ist die richtigte Reihenfolge um der API zu sagen: lege Kunde und Kunenadresse(n) an?
-
Die Datenstruktur unter relationships ist komplett optional und kann einfach leer {} gelassen werden, richtig?
{
“data”: {
“type”: “customer”,
“id”: “4f071f5236c248d599b3f37494787ed9”,
“attributes”: {
“groupId”: “string”,
“defaultPaymentMethodId”: “string”,
“salesChannelId”: “string”,
“languageId”: “string”,
“lastPaymentMethodId”: “string”,
“defaultBillingAddressId”: “string”,
“defaultShippingAddressId”: “string”,
“customerNumber”: “string”,
“salutationId”: “string”,
“firstName”: “string”,
“lastName”: “string”,
“company”: “string”,
“email”: “string”,
“title”: “string”,
“active”: true,
“guest”: true,
“firstLogin”: “2019-11-12T15:37:10.574Z”,
“lastLogin”: “2019-11-12T15:37:10.574Z”,
“newsletter”: true,
“birthday”: “string”,
“customFields”: {},
“additionalProp1”: {}
},
“relationships”: {
“group”: {
“links”: {
“related”: “/customer/4f071f5236c248d599b3f37494787ed9/group”
},
“data”: {
“type”: “customer_group”,
“id”: “46e9b365689f46299b0c8913ebf43d4e”
}
},
“defaultPaymentMethod”: {
“links”: {
“related”: “/customer/4f071f5236c248d599b3f37494787ed9/defaultPaymentMethod”
},
“data”: {
“type”: “payment_method”,
“id”: “985408c3bc1647d79e6fcc128287a07d”
}
},
“salesChannel”: {
“links”: {
“related”: “/customer/4f071f5236c248d599b3f37494787ed9/salesChannel”
},
“data”: {
“type”: “sales_channel”,
“id”: “290ed506623d4c85862adf69c8864307”
}
},
“language”: {
“links”: {
“related”: “/customer/4f071f5236c248d599b3f37494787ed9/language”
},
“data”: {
“type”: “language”,
“id”: “da74702f3f5b4538bd47075e21185dd9”
}
},
“lastPaymentMethod”: {
“links”: {
“related”: “/customer/4f071f5236c248d599b3f37494787ed9/lastPaymentMethod”
},
“data”: {
“type”: “payment_method”,
“id”: “be42fc897f844ffb9dafd63cd2d92067”
}
},
“defaultBillingAddress”: {
“links”: {
“related”: “/customer/4f071f5236c248d599b3f37494787ed9/defaultBillingAddress”
},
“data”: {
“type”: “customer_address”,
“id”: “0dbfaf024ae44a9eb5af57ab506a20e9”
}
},
“defaultShippingAddress”: {
“links”: {
“related”: “/customer/4f071f5236c248d599b3f37494787ed9/defaultShippingAddress”
},
“data”: {
“type”: “customer_address”,
“id”: “bb3d7e7fcc6a4493b9e67787cc99d7b6”
}
},
“salutation”: {
“links”: {
“related”: “/customer/4f071f5236c248d599b3f37494787ed9/salutation”
},
“data”: {
“type”: “salutation”,
“id”: “6d3f9e7ee006450a98d725ceffac3e3c”
}
},
“addresses”: {
“links”: {
“related”: “/customer/4f071f5236c248d599b3f37494787ed9/addresses”
},
“data”: [
{
“type”: “customer_address”,
“id”: “73bdd4877f5f4582b241be976a946f32”
}
]
},
“orderCustomers”: {
“links”: {
“related”: “/customer/4f071f5236c248d599b3f37494787ed9/orderCustomers”
},
“data”: [
{
“type”: “order_customer”,
“id”: “f89e05b95c574e35b001ab8819648028”
}
]
},
“tags”: {
“links”: {
“related”: “/customer/4f071f5236c248d599b3f37494787ed9/tags”
},
“data”: [
{
“type”: “tag”,
“id”: “08369c85edef442b8aed3ff3898e3b88”
}
]
},
“promotions”: {
“links”: {
“related”: “/customer/4f071f5236c248d599b3f37494787ed9/promotions”
},
“data”: [
{
“type”: “promotion”,
“id”: “cbdc35d9f251452bb13e8c4357b3e0aa”
}
]
},
“productReviews”: {
“links”: {
“related”: “/customer/4f071f5236c248d599b3f37494787ed9/productReviews”
},
“data”: [
{
“type”: “product_review”,
“id”: “8e6a300f523647d9b36b4787984a8905”
}
]
}
},
“links”: {
“self”: “/customer/4f071f5236c248d599b3f37494787ed9”
},
“meta”: {
“additionalProp1”: {}
}
},
“included”: [
{
“type”: “string”,
“id”: “string”,
“attributes”: {
“additionalProp1”: {}
},
“relationships”: {},
“links”: {},
“meta”: {
“additionalProp1”: {}
}
}
]
}
Danke im Vorraus