Post Order To Ordoro

I’m trying to post an order to Ordoro but I keep getting an error. {“error_message”: “The input field ‘shipping_address[street1]’ was not expected.”, “param”: null}

Here is a snippet of my request body

body = {:cart => cart, :shipping_address => {:street1 => street1 } }

If I do :shipping_address = “” and :billing_address => “” I get a successful post request but I can’t seem to figure out how to include the actual shipping/billing details in the request.

Please advise.

Hi Sophie, I looked through the GitHub examples you provided, and I still can’t seem to get anywhere.

I’m coding this in Ruby just an FYI.

Say for example I have this code below:
order_data = {“cart”: cart, “order_id”: order_id, “status”: “new”, “shipping_address”: {“name”: “Alex”}}
put_order = HTTParty.post(“https://api.ordoro.com/order/”, { :basic_auth => auth, “Content-Type” => “application/json”,
:body => order_data })

**I know I’m missing required info but as it’s reading the code, it keeps erroring out at the shipping address section, so I haven’t added the rest of the required info.

The error message still reads below - it doesn’t even seem to be picking up that param I’m trying to pass information into. This seems simple that it would just be a nested hash (at least that’s how I’m ready the API docs/examples) but I can’t seem to make it work.
{“error_message”: “The input field ‘shipping_address[name]’ was not expected.”, “param”: null}

Hi @rrw06,

Are you on version 2 or 3 of Ordoro. If you are on version 3, be sure to look at the correct documentation, as we have a different API for v3 Orders.

Have you inspected the request body to ensure that the nested values are streaming through as json as expected?

Have you included all of the fields for the addresses?

Sophie

Hi Sophie,

Version 2

Yes, confirmed.

Yes, see below. In my code you’ll see variables - these variables are string values unless the required field calls for an integer. I just ran the code below and got this error: {“error_message”: “The input field ‘shipping_address[street1]’ was not expected.”, “param”: null}

I also have to use the “endpoint” because it says new users can only post 2 links. But the endpoint used was the endpoint used in the example above.

put_order = HTTParty.post(endpoint,
:basic_auth => auth,
:body => {
:cart => cart,
:shipping_address => {
“street1” => street1,
:street2 => street2,
:zip => zip_code,
:state => state,
:name => name,
:city => city,
:country => country,
:email => "alex@roadreadywheels.com",
:phone => phone_number,
:fax => “”
},
:billing_address => {
:company => “”,
:street1 => street1,
:street2 => street2,
:zip => zip_code,
:state => state,
:name => name,
:city => city,
:country => country,
:email => "alex@roadreadywheels.com",
:phone => phone_number,
:fax => “”
},
:order_id => order_id,
:status => “new”,
:product_amount => product_amount,
:shipping_amount => shipping_amount,
:tax_amount => tax_amount,
:discount_amount => 0.0,
:grand_total => grand_total,
:lines => {
:product => {
:sku => ‘560-8075’,
:name => ‘malibu wheel’
},
:cart_orderitem_id => order_id,
:item_price => product_amount,
:selected_option => “”,
:option_price => “”,
:total_price => grand_total,
:product_name => ‘560-8075’,
:quantity => 2
}
})

Will you post the payload instead of the code?