首页 > 解决方案 > 使用 PATCH API 调用更新现有数据

问题描述

我正在尝试使用 API 调用更新一些现有数据,如下所示:

import requests

url = "https://apisandbox.paylocity.com/api/v2/companies/ABC/employees/123/?grant_type=client_credentials&scope=WebLinkAPI&client_id=client_id&client_secret=client_secret"


payload = {'firstName' : 'Kevin'}
headers = {'Authorization': 'Bearer ACCESS TOKEN'}

response = requests.request("PATCH", url, headers=headers, data=payload)

print(response.text)

这将返回以下消息。

{"message":"The request entity's media type 'application/x-www-form-urlencoded' is not supported for this resource."}

我需要更改什么以确保我能够更新现有数据

标签: pythonapi

解决方案


推荐阅读