Reputation: 251
I want to follow a user on Twitter with the help of code. I am using below mentioned code.
HttpWebRequest messageRequest =
(HttpWebRequest)WebRequest.Create("http://twitter.com/friendships/create/" +
userIdToFollow + ".xml?follow=true");
messageRequest.Method = "POST";
messageRequest.Credentials = new NetworkCredential(username, password);
messageRequest.ContentLength = 0;
messageRequest.ContentType = "application/x-www-form-urlencoded";
WebResponse response = messageRequest.GetResponse();
StreamReader sReader = new StreamReader(response.GetResponseStream());
responseStr = sReader.ReadToEnd();
I am getting an error while getting the response
The remote server returned an error: (404) Not Found.
Am I missing something ?
Upvotes: 0
Views: 1043
Reputation: 239450
Yep. The correct URL:
https://api.twitter.com/1.1/friendships/create
See this resource: https://dev.twitter.com/docs/api/1.1/post/friendships/create
Upvotes: 1
Reputation: 63562
What version of the API are you using?
v1
https://dev.twitter.com/docs/api/1/post/friendships/create
v1.1
https://api.twitter.com/1.1/friendships/create.json
I'm not sure where you got that Url but did you try using https?
Upvotes: 1