如何在pleandmarket Rest api中设置订单备注?

问题描述 投票:0回答:1

如何在大量市场休息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 创建注释(注释)。 请帮我解决这个问题?

php curl
1个回答
0
投票

老了,但自从我在这里

您忘记了发布数据中的

userId

参见https://developers.plentymarkets.com/en-gb/plentymarkets-rest-api/index.html#/Comment/post_rest_comments

示例是从我的脚本中复制的,但您明白了:

$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'];
© www.soinside.com 2019 - 2024. All rights reserved.