![](/img/trans.png)
[英]Google Places v3 API autocomplete - cannot get locality working?
[英]API Jive get categories error : Uncaught Passed URI does not match “/places/{uri}”: /api/core/v3/places/
我使用Jive,我想獲取所有類別,對於每個類別,我想為每個類別創建一個復選框。 當前,我擁有所有類別的數組,但是當我嘗試創建復選框時,它返回此錯誤:“未捕獲的傳遞的URI與“ / places / {uri}”不匹配:/ api / core / v3 / places /“有人可以幫助我嗎?
///////////////// function checkbox for each category //////////////// $("#submit_a_question").click(function(e) { e.preventDefault(); $("#modal").addClass('is-show'); $("#ideasContainer").height((height + 100) + "px"); resizeIframe(); fieldsPlaceholder(appLang); var categoriesToShow = categories(placeID); var container = $('#listCheckboxCategories'); var listCheckboxCategories = $('#listCheckboxCategories'); var CheckboxCreate = $('input />', {type: 'checkbox'}); if(tileConfig.isThereFilterRadios == "Yes"){ $('#ShowCategories').show(); $('#listDropdownCategories').show(); $.each(categoriesToShow.res, function(index, value) { CheckboxCreate.appendTo(container); }); } ///////// function to get all categories in an array ///////// function categories(placeID){ var request = osapi.jive.corev3.places.get({ uri : '/api/core/v3/places/' + placeID }); // var res = []; request.execute(function(response) { if (typeof response.error != 'undefined') { console.log("API call failed"); } else { console.log(response); response.getCategories().execute( function (res){ console.log("cat",res); }); } }); }
通過使用URI中的“ / places / {placeId}”,我能夠成功執行調用,如下所示:
osapi.jive.corev3.places.get({uri: '/places/1003'}).execute(function(response) {
console.log(response);
});
如預期的那樣,我已經在響應中收到了放置對象:
{ type: "space",
parent: "http://localhost:8080/api/core/v3/places/1000",
placeTopics: Array(0),
displayName: "water-cooler",
iconCss: "jive-icon-space", …}
您確定您的“ placeId”值正確嗎? 也許在撥打電話之前記錄您要發送的URI,然后檢查格式是否符合我上面提到的格式。 謝謝。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.