我正在尝试使用 python FASTAPI 在 Xero 中添加一个新联系人:
定义一个新的联系人
contact = {
"Contacts": [
{
"Name": "24 locks",
"FirstName": "Ben",
"LastName": "Bowden",
"EmailAddress": "ben.bowden@24locks.com",
"ContactPersons": [
{
"FirstName": "John",
"LastName": "Smith",
"EmailAddress": "john.smith@24locks.com",
"IncludeInEmails": "true"
}
]
}
]
}
调用 xero API
get_url = 'https://api.xero.com/api.xro/2.0/Contacts'
response = requests.post(get_url,
headers = {
'Authorization': 'Bearer ' + access_token,
'Xero-tenant-id': xero_tenant_id,
'Accept': 'application/json'
},
data = contact
)
json_response = response.json()
我收到以下错误:
{'ErrorNumber': 17, 'Type': 'NoDataProcessedException', 'Message': 'No data has been processed for this endpoint. This endpoint is expecting Contact data to be specifed in the request body.'}
有人可以帮忙吗?
您可以假设access_token
并且xero_tenant_id
是正确的,因为我将它们用于其他方法并且它们工作正常。
谢谢