Magento 从 REST 更改订单状态 API
Magento Change Order Status from REST API
我 'communicating' 通过 C# ASP.NET MVC 应用程序中的 REST API 使用 Magento 网络应用程序(版本 1.9.2.2)。
该应用程序本质上充当比萨饼的后端订单流仪表板。我需要显示最新的订单,并允许用户在处理商品时勾选它们(除其他外)。
我能够检索订单、产品、客户等;但需要能够更新订单状态。根据我的研究,这似乎可以通过添加订单评论来实现。
也就是说,我的问题如下:
- 是否只能通过 Magento 1.9 中的 SOAP 服务添加订单评论(从而更新订单状态)?
- 如果上述情况属实,我如何使用另一种 secure 方法更新特定订单的订单状态?
关于 REST 的文档 API:http://devdocs.magento.com/guides/m1x/api/rest/Resources/Orders/order_comments.html
对于可能面临相同问题的任何人,我发现无法通过 REST API 更新订单状态(也就是添加销售订单评论)。您必须使用 SOAP API,而版本 2 使它变得最简单。
设置:
- 在 magento 中,创建一个 SOAP 角色和用户
- 添加 SOAP v2 API 作为对您的 Visual Studio 项目的 Web 引用
代码:
public void UpdateOrderStatus(string orderIncrementId, string newStatus, string comment = "")
{
// Init service with uri
var service = new MagentoSoap.MagentoService();
// Login - username and password (soap api key) of the soap user
string sessionId = service.login(Username, Password);
// Update order status
service.salesOrderAddComment(sessionId, orderIncrementId, newStatus, comment, 1, true);
}
您可以使用 addComment 方法执行此操作,该方法还允许您将新订单状态指定为其参数之一。
$sku='100000003';
$orderStatus = 'Downloaded';
$comment = 'The order was successfully downloaded';
$sendEmailToCustomer = false;
$proxy->call($sessionId, 'sales_order.addComment', array($sku, $orderStatus, $comment, $sendEmailToCustomer));
我 'communicating' 通过 C# ASP.NET MVC 应用程序中的 REST API 使用 Magento 网络应用程序(版本 1.9.2.2)。
该应用程序本质上充当比萨饼的后端订单流仪表板。我需要显示最新的订单,并允许用户在处理商品时勾选它们(除其他外)。
我能够检索订单、产品、客户等;但需要能够更新订单状态。根据我的研究,这似乎可以通过添加订单评论来实现。
也就是说,我的问题如下:
- 是否只能通过 Magento 1.9 中的 SOAP 服务添加订单评论(从而更新订单状态)?
- 如果上述情况属实,我如何使用另一种 secure 方法更新特定订单的订单状态?
关于 REST 的文档 API:http://devdocs.magento.com/guides/m1x/api/rest/Resources/Orders/order_comments.html
对于可能面临相同问题的任何人,我发现无法通过 REST API 更新订单状态(也就是添加销售订单评论)。您必须使用 SOAP API,而版本 2 使它变得最简单。
设置:
- 在 magento 中,创建一个 SOAP 角色和用户
- 添加 SOAP v2 API 作为对您的 Visual Studio 项目的 Web 引用
代码:
public void UpdateOrderStatus(string orderIncrementId, string newStatus, string comment = "")
{
// Init service with uri
var service = new MagentoSoap.MagentoService();
// Login - username and password (soap api key) of the soap user
string sessionId = service.login(Username, Password);
// Update order status
service.salesOrderAddComment(sessionId, orderIncrementId, newStatus, comment, 1, true);
}
您可以使用 addComment 方法执行此操作,该方法还允许您将新订单状态指定为其参数之一。
$sku='100000003';
$orderStatus = 'Downloaded';
$comment = 'The order was successfully downloaded';
$sendEmailToCustomer = false;
$proxy->call($sessionId, 'sales_order.addComment', array($sku, $orderStatus, $comment, $sendEmailToCustomer));