我的JavaScript代码有什么错误?
function getAllLeads() {
client.request.get("https://padmanabh.freshsales.io/api/leads/filters", {
headers: {
Authorization: "O5n0xfwgtg",
"Content-Type": "application/json;charset=utf-8"
}
})
.then(function () {
console.error("Success");
})
.catch(function (error) {
console.error(error);
});
}
curl中类似的请求正在按如下方式工作,
curl -H "Authorization: Token token=O5n0xfwgtg" -H "Content-Type: application/json" -X GET "https://padmanabh.freshsales.io/api/leads/filters
((API_KEY已修改,请不要尝试)
根据您的问题所写的:
function getAllLeads() {
client.request.get("https://padmanabh.freshsales.io/api/leads/filters", {
headers: {
Authorization: = "O5n0xfwgtg",
"Content-Type": "application/json;charset=utf-8"
}
})
授权:=“ O5n0xfwgtg”,缺少Token token =
您可能在这里找到答案:Basic Authentication Using JavaScript