Zed
Zed

Reputation: 671

Explain what I am doing wrong with my HTTP POST to Yo

I have never done any posting data before and I think I may have missed something, I am trying to send a POST to Yo using what help I have but I am still left a bit confused.

using (var wb = new WebClient())
{
    var data = new NameValueCollection();
    data["api_token"] = "<API I was sent>";
    var response = wb.UploadValues("http://api.justyo.co/yoall/", "POST", data);
}

Correct api token used, I'm not 100% sure about the data names "username" nor "password" but I couldn't see anything that said anything else and the names make sense.


(IYDK: Yo is a no character social messaging app which you tap a name and it will send a "yo" notification, the POST should send a 'yo' to everyone on my contacts)

Upvotes: 0

Views: 126

Answers (2)

zapoo
zapoo

Reputation: 1589

Can you provide more information by using code below ?

var message = string.Format("\nResponse received was :\n{0}", Encoding.ASCII.GetString(response));

and

I develop a single app and it works, hope it helps.

https://github.com/cguldogan/YoSharp

Upvotes: 0

coolerfarmer
coolerfarmer

Reputation: 385

If you would read the api documentation you would see this:

HTTP POST using your favorite language or “curl —data “api_token=” http://api.justyo.co/yoall/

U can clearly see that you only have to send the "api_token"

try this:

using (var wb = new WebClient())
{
    var data = new NameValueCollection();
    data["api_token"] = "REPLACE_WITH_YOUR_API_TOKEN";
    var response = wb.UploadValues("http://api.justyo.co/yoall/", "POST", data);
}

Upvotes: 1

Related Questions