[英]Printing sales order doesnt work with exact online
I am trying to print a sales order with a known OrderId however it throws an error which I haven't been able to debug.我正在尝试使用已知的 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 is:错误是:
{'error': {'code': '',
'message': {'lang': '',
'value': "Error reading syndication item: 'Data at the root level is invalid. Line 1, position 1.'."}}}
What is the problem here?这里有什么问题? Please help
请帮忙
It turns out you need to use the json argument instead of using data.事实证明您需要使用 json 参数而不是使用数据。
This这个
requests.post("url",headers=headers, data=printest)
becomes成为
requests.post("url",headers=headers, json=printest)
Content-Type
header can be set as application/json
Content-Type
header 可以设置为application/json
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.