You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
List<string>profileUrls=newList<string>();profileUrls.Add("https://plus.google.com/114222978585544488148/about?hl=en");profileUrls.Add("https://plus.google.com/117313296997732479889/about?hl=en");profileUrls.Add("https://plus.google.com/111550668382222753542/about?hl=en");apiApi=newapi("<INSERT_API_KEY>","<INSERT_API_SECRET>");batchApibatchRequest=newbatchApi(Api);// Create a new batchintbatchId=batchRequest.Create();// Add jobs to batchforeach(variteminprofileUrls){varparameters=newapi.Parameters();parameters.Add("batch-id",batchId);parameters.Add("profile-url",item);parameters.Add("country","USA");varjobId=Api.Post("/v4/ld/fetch-reviews",parameters);if(jobId.ResponseStatus==ResponseStatus.Completed){dynamicjob=JsonConvert.DeserializeObject(jobId.Content);if(!job.success){stringmessage="Error adding job";varbatchException=newApplicationException(message+job.errors,job.ErrorException);throwbatchException;}}else{thrownewApplicationException(jobId.ErrorMessage);}}// Commit the batch, resturns true or falseboolcommit=batchRequest.Commit(batchId);// Poll for results. In a real world example you should do this in a backgroud process, such as HangFire, or use the Task Parallel Library to create a BackGroundWorker Task.// It is bad practice to use Thread.Sleep(). This is only for the example and will actually freeze the UI until the while loop is finished. varresults=batchRequest.GetResults(batchId);dynamicreviewResults=JsonConvert.DeserializeObject(results.Content);if(reviewResults.success){while(reviewResults.status!="Stopped"||reviewResults.status!="Finished"){Thread.Sleep(10000);results=batchRequest.GetResults(batchId);reviewResults=JsonConvert.DeserializeObject(results.Content);}returnreviewResults;}else{conststringmessage="Error Retrieving batch results ";varbatchException=newApplicationException(message+rankingResults.errors,results.ErrorException);throwbatchException;}
Fetch Reviews (by business data)
List<string>localDirectories=newList<string>();localDirectories.Add("google");localDirectories.Add("facebook");localDirectories.Add("yahoo");apiApi=newapi("<INSERT_API_KEY>","<INSERT_API_SECRET>");batchApibatchRequest=newbatchApi(Api);// Create a new batchintbatchId=batchRequest.Create();// Add jobs to batchforeach(variteminlocalDirectories){varparameters=newapi.Parameters();parameters.Add("batch-id",batchId);parameters.Add("business-names","Le Bernardin\nLe Bernardin Cafe");parameters.Add("city","New York");parameters.Add("postcode","10019");parameters.Add("local-directory",item);parameters.Add("country",USA);varjobId=Api.Post("/v4/ld/fetch-reviews-by-business-data",parameters);if(jobId.ResponseStatus==ResponseStatus.Completed){dynamicjob=JsonConvert.DeserializeObject(jobId.Content);if(!job.success){stringmessage="Error adding job";varbatchException=newApplicationException(message+job.errors,job.ErrorException);throwbatchException;}}else{thrownewApplicationException(jobId.ErrorMessage);}}// Commit the batch, resturns true or falseboolcommit=batchRequest.Commit(batchId);// Poll for results. In a real world example you should do this in a backgroud process, such as HangFire, or use the Task Parallel Library to create a BackGroundWorker Task.// It is bad practice to use Thread.Sleep(). This is only for the example and will actually freeze the UI until the while loop is finished. varresults=batchRequest.GetResults(batchId);dynamicreviewResults=JsonConvert.DeserializeObject(results.Content);if(reviewResults.success){while(reviewResults.status!="Stopped"||reviewResults.status!="Finished"){Thread.Sleep(10000);results=batchRequest.GetResults(batchId);reviewResults=JsonConvert.DeserializeObject(results.Content);}returnreviewResults;}else{conststringmessage="Error Retrieving batch results ";varbatchException=newApplicationException(message+rankingResults.errors,results.ErrorException);throwbatchException;}