when I put all my code in I couldn't figure out why I was getting a Bad Request
sent back as the error thrown.
When I finally added code to get the SocialRatingManager to make a call
(GetRating()) I got the bad request sent back to me. I can't for the life of me figure out why!
Below are code snippets, in case they help. Thanks for any help in advance. Let me know if I should provide anymore information.
public interface ITestService
[WebInvoke(Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
int SetVotes(string url, string listName);
public int SetVotes(string url, string listName)
int test = 60;
using (SPSite site = new SPSite(url))
using (SPWeb ElevatedWeb = site.OpenWeb())
var item = ElevatedWeb.Lists[listName].Items.GetItemById(GetItemID(url));
test = Convert.ToInt32(item["Votes"]);
var serviceContext = SPServiceContext.GetContext(site);
var uri = new Uri(url);
var ratingManager = new SocialRatingManager(serviceContext);
var test2 = ratingManager.GetRating(uri);
private int GetItemID(string url)
int index = url.IndexOf("?");
if (index > 0)
url = url.Substring(index).Remove(0, 1);
var node = HttpUtility.ParseQueryString(url).Get("ID");