python - 使用 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."}
我需要更改什么以确保我能够更新现有数据
解决方案
推荐阅读
- apache-superset - 在虚拟环境中安装超集的源代码在哪里?
- solr - 在 Solr Cloud schema.xml 和 Lucene Monitor 之间共享 lucene 分析器
- python-3.x - argparser - 添加位置参数,选项直接指定值
- node.js - 无法使用 TypeOrm 并找不到明确的“连接”默认值“
- sql - 获取输出的 SQL 查询
- c# - 绑定后对象数据未显示在 DataGridView 中
- c# - 使用 Task.Run 长时间运行的任务
- powershell - 将多个用户添加到 AD PowerShell 脚本
- angular - 尝试从 Angular HTTP 中的响应标头获取字符串值并映射到本地存储
- java - 如何从 JUnit 中的时间延迟条件中覆盖丢失的分支