I'm using C# with ASP.NET to make a game. I have a method to send post request and it's working fine in all request ( i.e. loging, scores ) exept when I try to give an earned achievement. In this case the server return Bad Request ( status - protocol error ) instead of (#3501) User has already earned .... This is a snipped from my method for sending
public static string SendRequest(string sUrl,
string sRequest,
string sMethod,
string sContentType = "application/x-www-form-urlencoded")
{
HttpWebRequest request;
StreamReader reader;
string sResponse;
Encoding encoding = Encoding.UTF8; //I try different encoding without luck
switch (sMethod.ToUpper())
{
case "POST":
case "DELETE":
//Initialize the WebRequest
request = (HttpWebRequest)HttpWebRequest.Create(sUrl);
request.AllowAutoRedirect = false;
request.Method = sMethod.ToUpper();
request.ContentType = sContentType;
request.ServicePoint.Expect100Continue = false;
byte[] data = encoding.GetBytes(sRequest);
request.ContentLength = data.Length;
Stream stream =request.GetRequestStream();
stream.Write( data, 0, data.Length );
stream.Close();
break;
....
So to give an new achievement I call this method:
SendRequest( achievementURL, achievementParams, POST
);
If I make second call Graph API return Bad Request instead of #3501
I can delete earned achievement without error ( SendRequest( achievementURL, achievementParams, DELETE
);
I try to use different encodings without any luck. Can it be a bug in Graph API?! ( Graph API Explorer works fine )
Any help will be appreciateble