I've been doing read only requests for awhile and have that working. I'm switching over to try to do some of the post api calls. I am trying to use RestSharp. I can do it if I have all of the auth1 variables in the addparameter application/x-www-form-urlencoded section. However, using the Authenticator method returns back of NotAcceptable.
The main difference I noticed is if I look at it in Fiddler the one that works has everything in the body arguments. The one that doesn't work has the oauth stuff in the Auth tab. Is there something about the Goodreads api that doesn't allow me to use this method?
Here's the code I'm using: var client = new RestClient("https://www.goodreads.com/comment") { Authenticator = OAuth1Authenticator.ForProtectedResource(OAuthTokens.ConsumerKey, OAuthTokens.ConsumerSecret, OAuthTokens.AccessToken, OAuthTokens.AccessTokenSecret) };
var request = new RestRequest(Method.POST); request.AddHeader("content-type", "application/x-www-form-urlencoded"); request.AddHeader("cache-control", "no-cache"); request.AddParameter("application/x-www-form-urlencoded", "type=topic&id=18174085&comment%5Bbody%5D=hi", ParameterType.RequestBody);
The main difference I noticed is if I look at it in Fiddler the one that works has everything in the body arguments. The one that doesn't work has the oauth stuff in the Auth tab. Is there something about the Goodreads api that doesn't allow me to use this method?
Here's the code I'm using:
var client = new RestClient("https://www.goodreads.com/comment")
{
Authenticator = OAuth1Authenticator.ForProtectedResource(OAuthTokens.ConsumerKey, OAuthTokens.ConsumerSecret, OAuthTokens.AccessToken, OAuthTokens.AccessTokenSecret)
};
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/x-www-form-urlencoded");
request.AddHeader("cache-control", "no-cache");
request.AddParameter("application/x-www-form-urlencoded", "type=topic&id=18174085&comment%5Bbody%5D=hi", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Thanks.