[英]Facebook Graph Places Search API not working
我想使用Facebook Graph Places Search API提取位置图片,但是却收到错误0f 400错误请求。 我尝试使用User Acess令牌和App令牌,但仍然无法正常工作
这是代码
let input = document.getElementById("input");
document.getElementById("btn").addEventListener("click", () => {
let xhr = new XMLHttpRequest();
xhr.open("GET","https://graph.facebook.com/search?type=place&q=" + input.value + "&fields=picture&limit=3&access_token=XXXXXXXXXXXXXXXXXXXXXXX")
xhr.onload = function () {
if (this.status === 200) {
let data = JSON.parse(responseText)
console.log(data);
}
}
xhr.send();
})
根据使用的API版本,这很可能是由于图片字段造成的,您应该看到错误响应,例如(#100) Tried accessing nonexisting field (picture) on node type (PlaceInformation)
,或者从请求中删除图片字段或为该请求指定API版本(最高为v3.2)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.