如何在大量市场休息API中设置订单备注?
function setOrderNotes($orderId, $orderNote) {
// set parameter array
$params = array('referenceType'=>'order','referenceValue'=>$orderId,'text'=>$orderNote,'isVisibleForContact'=>true);
// make curl request to get order by id
$result = $this->_makeRequest('/rest/comments','POST', $params);
// return order array by order id
return $result;
}
上面的代码返回错误,而不是为订单 id 创建注释(注释)。 请帮我解决这个问题?
老了,但自从我在这里
您忘记了发布数据中的
userId
。
示例是从我的脚本中复制的,但您明白了:
$httpMethod = 'POST';
$path = "/rest/comments";
$params = [
'referenceType' => 'order', // allowed values are category, contact, order, register_incoming_items, item_variation, order_item
'referenceValue' => 116, // F.e. the order id.
'userId' => 7, // The id of the user that will make this comment.
'text' => "Some comment",
'isVisibleForContact' => false, // If true, the comment is visible for the associated contact.
];
$headers = ['Content-Type' => 'application/json'];