Hi,
ich schraube mit wachsender Verzweiflung an einem kleinen Ruby-Wrapper für die Api. Leider scheitere ich trotz Copy-Paste der Doku Beispiele daran eine Bestellung anzulegen. So versuche ich die Bestellung anzulegen:
require 'httparty'
require 'pp'
class SwApiWrapper
include HTTParty
base_uri '192.168.33.10/shopware/api'
digest_auth 'root', 'key'
def post_order()
self.class.post('/orders', :body => {'customerId' => 1,
'paymentId' => 4,
'dispatchId' => 9,
'partnerId' => '',
'shopId' => 1,
'invoiceAmount' => 201.86,
'invoiceAmountNet' => 169.63,
'invoiceShipping' => 0,
'invoiceShippingNet' => 0,
'orderTime' => '2012-08-31 08:51:46',
'net' => 0,
'taxFree' => 0,
'languageIso' => '1',
'currency' => 'EUR',
'currencyFactor' => 1,
'remoteAddress' => '192.168.33.10',
'details' => [
'articleId' => 2,
'taxId' => 1,
'taxRate' => 19,
'statusId' => 0,
'articleNumber' => 'SW10002.3',
'price' => 35.99,
'quantity' => 1,
'articleName' => 'Versandkostenfreier Artikel',
'shipped' => 0,
'shippedGroup' => 0,
'mode' => 0,
'esdArticle' => 0,
],
'documents' => [],
'billing' => [
'id' => 2,
'customerID' => 1,
'countryID' => 2,
'stateId' => 3,
'company' => 'shopware AG',
'salutation' => 'mr',
'firstName' => 'Max',
'lastName' => 'Mustermann',
'street' => 'Mustermannstra\u00dfe 92',
'zipCode' => '48624',
'city' => 'Sch\u00f6ppingen',
],
'shipping' => [
'id' => 2,
'countryId' => 2,
'stateId' => 3,
'customerId' => 1,
'company' => 'shopware AG',
'salutation' => 'mr',
'firstName' => 'Max',
'lastName' => 'Mustermann',
'street' => 'Mustermannstra\u00dfe 92',
'zipCode' => '48624',
'city' => 'Sch\u00f6ppingen'
],
'paymentStatusId' => 17,
'orderStatusId' => 0
}.to_json)
end
end
Leider bekomme ich obwohl die countryID im Billing eindeutig gesetzt wird dies zurück:
{"success"=>false,
"code"=>400,
"message"=>"A required parameter is missing: billing.countryId"}
Was mache ich hier falsch? Der Datensatz kommt wie gesagt aus der Doku:
https://developers.shopware.com/developers-guide/rest-api/examples/order/#search-results
Herzlichen Dank für eure Hilfe!