Get Number of blog comments from blog title in telligent 8.5 version

I am able to get the title of blog, now I want number of comments on particular blogs dynamically.

As per the api blog id and blogpostid is required

"api.ashx/v2/blogs/{blogid}/posts/{blogpostid}/comments.xml (or .json)"

Now how to get the blogid and blogpostid from blog title.

I am getting froum or blog post title from the below code.

success: function(response) {
TotalCount = response.TotalCount;
if(response.SearchResults.length > 0){
$('#sticky_header,#sticky_turnoff').empty();
$('#sticky_header').append('<div id="relevant_new_ questions"><div>Select relevant threads below:</div></div><div class="new_question"><a href="javascript:void(0)" id="skip-search" aria-label="Click here to post new Question" title="Click here to post new Question" >Click here to continue</a></div>');
$('#sticky_turnoff').append('<div class="turn-off-suggestions"><a id="skip-turnoff" title="Turn off suggestions" aria-label="Turn off suggestions">Turn off suggestions</a></div>');
response.SearchResults.forEach(function(v,i){

if(v.ContentType =='forumreply' || v.ContentType =='forum' ){
var threadid = v.ThreadId;
var APiendPoint = `api.ashx/v2/forums/threads/${threadid}/replies.json`
}
/*else if (v.ContentType =='blog)'{

var APiendPoint = `api.ashx/v2/blogs.json` 

}*/     (but it is not working)

else{

var ContentId = v.ContentTypeId;
var APiendPoint = `api.ashx/v2/comments.json?ContentTypeId=${ContentId}`

}

var ContentId = v.ContentTypeId;

jQuery.telligent.evolution.get({
//url: jQuery.telligent.evolution.site.getBaseUrl() + `api.ashx/v2/comments.json?ContentTypeId=${ContentId}`,
url: jQuery.telligent.evolution.site.getBaseUrl() + APiendPoint,

Parents
  • Looks like you're using the Search REST endpoint to retrieve your response.  The response will have an ApplicationId for the blog post that can be used to retrieve the blog using the blog rest endpoint, which will get you the blog id.  It also has the SectionId which is the blog id and the ContentId is the blog post id.

Reply
  • Looks like you're using the Search REST endpoint to retrieve your response.  The response will have an ApplicationId for the blog post that can be used to retrieve the blog using the blog rest endpoint, which will get you the blog id.  It also has the SectionId which is the blog id and the ContentId is the blog post id.

Children