[英]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.