打印销售订单不适用于精确的在线



我正试图打印一个具有已知OrderId的销售订单,但它引发了一个我无法调试的错误。

printest = {
"OrderId" : "0b28a174-524d-4fe3-b763-6b594d24afaa",
"DocumentLayout" : "78aabba4-dbc5-416a-bb09-51aeca8dfd5d"
}
headers = {
'Accept': 'application/json',  
'Content-Type': '*/*',
'Prefer': 'return=representation'
}
test = requests.post("https://start.exactonline.nl/api/v1/[division]/salesorder/PrintedSalesOrders",headers=headers, data=printest)
test.json()

错误为:

{'error': {'code': '',
'message': {'lang': '',
'value': "Error reading syndication item: 'Data at the root level is invalid. Line 1, position 1.'."}}}

这里有什么问题?请帮助

事实证明,您需要使用json参数,而不是使用数据。

这个

requests.post("url",headers=headers, data=printest)

成为

requests.post("url",headers=headers, json=printest)

Content-Type报头可以设置为application/json

最新更新