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
apiApi=newapi("<INSERT_API_KEY>","<INSERT_API_SECRET>");batchApibatchRequest=newbatchApi(Api);// Create a new batchintbatchId=batchRequest.Create();varparameters=newapi.Parameters();parameters.Add("batch-id",batchId);parameters.Add("website-url","http://le-bernardin.com");varjobId=Api.Post("/v4/seo/offsite",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 background 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);dynamicoffsiteResults=JsonConvert.DeserializeObject(results.Content);if(offsiteResults.success){while(offsiteResults.status!="Stopped"||offsiteResults.status!="Finished"){Thread.Sleep(10000);results=batchRequest.GetResults(batchId);offsiteResults=JsonConvert.DeserializeObject(results.Content);}returnresults;}else{conststringmessage="Error Retrieving batch results ";varbatchException=newApplicationException(message,results.ErrorException);throwbatchException;}
Fetch Details of the Socal Profiles of a Business
apiApi=newapi("<INSERT_API_KEY>","<INSERT_API_SECRET>");batchApibatchRequest=newbatchApi(Api);// Create a new batchintbatchId=batchRequest.Create();varparameters=newapi.Parameters();parameters.Add("batch-id",batchId);parameters.Add("website-url","http://le-bernardin.com");parameters.Add("fetch-twitter","yes");parameters.Add("fetch-facebook","yes");parameters.Add("fetch-foursqaure","yes");parameters.Add("business-names","['Le Bernardin', 'Bernardin Cafe']");parameters.Add("street-addess","155 West 51st Street");parameters.Add("city","New York");parameters.Add("state-code","NY");parameters.Add("telephone","+1 212-554-1515");parameters.Add("postcode","10019");parameters.Add("country","USA");varjobId=Api.Post("/v4/social/profiles",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 background 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);dynamicsocialResults=JsonConvert.DeserializeObject(results.Content);if(socialResults.success){while(socialResults.status!="Stopped"||socialResults.status!="Finished"){Thread.Sleep(10000);results=batchRequest.GetResults(batchId);socialResults=JsonConvert.DeserializeObject(results.Content);}returnresults;}else{conststringmessage="Error Retrieving batch results ";varbatchException=newApplicationException(message,results.ErrorException);throwbatchException;}