【发布时间】:2021-09-25 19:47:17
【问题描述】:
我希望在 Zapier 中添加一个步骤,其中仅查找票证的 cmets。
Zendesk 文档显示了以下 curl,这在 Postman 中完美运行并返回指定票证的所有 cmets。
“Zapier 编码”功能需要我输入 javascript 或 python。
我也不太了解,使用转换为 Python 的 Curl,我得到 output_missing 请定义输出或提前返回。
我想检索 JSON 中“type”:“Comment”和“public”:false 的所有内容,
curl https://{subdomain}.zendesk.com/api/v2/tickets/{ticket_id}/comments.json \
-H "Content-Type: application/json" -v -u {email_address}:{password}
如果有人能指出我正确的方向,将不胜感激。
代码如下:
import requests
import json
url = "domain.zendesk.com/api/v2/tickets/1234/comments.json"
payload={}
headers = {
'Content-Type': 'application/json',
'Authorization': 'Basic xxx'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
【问题讨论】:
-
代码在哪里?
-
import requests import json url = "domain.zendesk.com/api/v2/tickets/1234/comments.json" payload={} headers = { 'Content-Type': 'application/json', 'Authorization': 'Basic xxx' } response = requests .request("GET", url, headers=headers, data=payload) print(response.text)
标签: javascript python zapier zendesk