[英]Printing sales order doesnt work with exact online
我正在嘗試使用已知的 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
header 可以設置為application/json
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.