I want to use the Facebook Graph Places Search API to extract pictures of places however i get an error 0f 400 bad request. I tried using the User Acess token and the App token but it still doesn't work
Here is the code
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)。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.