Struggling to update Item - Sales Price

So as will probably become apparent I am quite new to the REST API and am trying to use PUT to update a record.

Everything is updating fine EXCEPT for the sales price (my app doesn't make use of the wholesale or trade prices at the moment).

I am probably overlooking something really simpe and have altered my code to try various different things and have officially given up in the hope of help.

We are due to get our shop online next week and require this to automatically update the pricing on thousands of lines.

IF anyone could give me a heads up on where I'm going wrong it would be appreciated.

The code I'm using is below : -

$data = array(
                    'stock_item' => array(
                                                            'displayed_as' => "Same as description",
                                                            'item_code' => "Item Code",
                                                            'description' => "The description of the item",
                                                            'notes' => "These are the updated notes for the item.",
                                                            'cost_price' => "50.00",

                                                             'sales_prices' => array(
                                                                                'price' => "100.00"

                                                            'purchase_description' => "Purchase description",
                                                            'supplier_part_number' => "Supplier Part Number"

This works fine on everything except for the sales_prices field, but if I include this I get one of the following errors.

array(1) { [0]=> object(stdClass)#1 (4) { ["$severity"]=> string(5) "error" ["$dataCode"]=> string(13) "RecordInvalid" ["$message"]=> string(36) "The service_rate_type_id is invalid." ["$source"]=> string(17) "service_rate_type" } }


array(1) { [0]=> object(stdClass)#1 (4) { ["$severity"]=> string(5) "error" ["$dataCode"]=> string(10) "Validation" ["$message"]=> string(35) "stock_item[sales_prices] is invalid" ["$source"]=> string(24) "stock_item[sales_prices]" } }

Depending on how I structure my code.

I am fairly sure it is down to how I am structuring my nested arrays, but would be most grateful for any help.

While I am here, I have also noticed that I am unable to update the displayed_as field. This just takes on the value of whatever is PUT in the description field; not sure if that is done by design or not, but something I spotted the other day.

Look forward to hearing from someone soon.

Parents Reply Children