私はこのapiに問題があり、やりとりを乗り越えるように見えません。 HTTP gemを使用しています(ただし、柔軟性があり、回答が早い場合はRestClientを使用できます)。とにかく、配列のポストに問題があります。他のすべてが良いですが、私はちょうどprintaura APIで、この「itemsArrayの」を把握することはできませんaddorder方法でここに見つける:PrintAura APIAPI HTTPのgem(またはRestClient)を使用した配列のPOST
私はこの実行している:
def self.submitorder
req = HTTP.post("https://api.printaura.com/api.php", :json => {
:key => APIKEY,
:hash => APIHASH,
:method => "addorder",
:businessname => "this is a secret too",
:businesscontact => "thats a secret",
:email => "[email protected]",
:your_order_id => "1",
:returnlabel => "FakeAddress",
:clientname => "ShippingName",
:address1 => "ShippingAddressLine1",
:address2 => "ShippingAddressLine2",
:city => "ShippingCity",
:state => "ShippingState",
:zip => "ShippingZip",
:country => "US",
:customerphone => "dontcallme",
:shipping_id => "1",
:itemsarray => {:item => [
:product_id => 423,
:brand_id => 33,
:color_id => 498,
:size_id => 4,
:front_print => 1389517,
:front_mockup => 1390615,
:quantity => 1
]}
})
puts JSON.parse(req)
end
そして、私の出力は、このです:
{"status"=>false, "error_code"=>19, "result"=>19, "message"=>"You cannot place an order without items, Please fill the items array with all the required information. Full API documentation can be found at https:/www.printaura.com/api/"}
誰かがそれを見て私を助けてくれたら、私は永遠にそれを感謝します。
から何年か誰かを助けたいと考えています。私はとても困惑しています。私は早くもそれを試みた。私はちょうどそれが$ postfieldから$ itemsarrayに変更されて以来、私は 'itemsarray' – bwatson30