Question

I try to get the token from my fogbugz website, folowing :

http://fogbugz.stackexchange.com/fogbugz-xml-api

I have :

using (var wb = new WebClient())
{   
                var data = new NameValueCollection();
                data["cmd"] = HttpUtility.UrlEncode(cmdLogon);
                data["email"] = HttpUtility.UrlEncode(email);
                data["password"] = HttpUtility.UrlEncode(password);
                content = encoding.GetString(wb.UploadValues(url, "POST", data));
 }

Below the Server Response :

<?xml version="1.0" encoding="UTF-8"?><response><error code="1">Nom d'utilisateur ou mot de passe incorrect</error></response>

I can see the request in IIS logs but parameters are absent.

What I'm doing wrong?

edit : I'm sure parameters are correct cause I tested In the browser and it work well.

Was it helpful?

Solution

I ran this with Fiddler, and your code sends a request with the following content in the request body:

cmd=logon&email=test-email&password=test-password

Instead, I believe you should be sending this information in the query string as per the documentation (see the "Logging On" section):

http://www.example.com/api.asp?cmd=logon&email=xxx@example.com&password=BigMac

If you want to use a NameValueCollection to build your querystring, this answer provides a way to do that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top