Willy Nguyen
Willy Nguyen

Reputation: 19

API Jive get categories error : Uncaught Passed URI does not match "/places/{uri}": /api/core/v3/places/

i use Jive and i want to get all categories and for each category, i want to create a checkbox for each of them. Currently, i have my array with all categories, but when i try to create checkbox, it return me this error : " Uncaught Passed URI does not match "/places/{uri}": /api/core/v3/places/ " Someone can help me ?

///////////////// 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);
				}); 
	    }
	});
}

Upvotes: 0

Views: 80

Answers (1)

André Barbosa
André Barbosa

Reputation: 724

I was able to execute the call successfully by using "/places/{placeId}" in the URI as below:

osapi.jive.corev3.places.get({uri: '/places/1003'}).execute(function(response) { 
    console.log(response); 
});

For which I have received the place object in the response, as expected:

{ type: "space", 
  parent: "http://localhost:8080/api/core/v3/places/1000", 
  placeTopics: Array(0), 
  displayName: "water-cooler", 
  iconCss: "jive-icon-space", …}

Are you sure your "placeId" has the correct value? Maybe log the URI you are sending before making the call and check if the format matches the one I have mentioned above. Thanks.

Upvotes: 0

Related Questions