2

I want to trace records of all the completed orders which has been received from my Magento store to my ERP store through Rest API. I have created custom column through SQL query in sales_order so that I can get all those orders whose custom order value is set to 0 (default value).

I am using this API

index.php/rest/V1/orders?searchCriteria[filter_groups][0][filters][0][field]=custom_attribute&searchCriteria[filter_groups][0][filters][0][value]=1

to get all the records of matching custom column value which is working perfect. However I need an API through which I can update the custom column value to 1 once I receive that order.

Is there any API available through which I can able to update the custom column value by order id?

  • I came to know there is this API with PUT method index.php/rest/V1/orders/1 through which i can update the column data by passing entity[custom-attribute] = 0 but its throughing the unknown setter and getter error even after i have created the set and get method for this attribute in both controller and Model of OrderrepositoryInterface and orderInterface – Zeeshan Khuwaja Jan 23 '17 at 16:13
  • Now its throwing this exception even after creating custom order attribute setter and getter method on orderinterface { "message": "Class 0 does not exist", "code": -1, "trace": "#0 /var/www/html/vangsgaards/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php(148): ReflectionClass->__construct('0') #1 /var/www/html/vangsgaards/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php(322): Magento\Framework\Webapi\ServiceInputProcessor->_createFromArray('0', Array) #2 /var/www/html/vangsgaards/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php(175) – Zeeshan Khuwaja Jan 23 '17 at 16:20
0

Never mind just found out the answer by myself. Magento2 Update Order attributes API index.php/rest/V1/orders/:orderid does not allow to update custom order attributes. So i have created my own custom API to cater my requirement

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.