我很难使用restsharp在linkedin上工作。这是我的代码:
var shareMsg = new
{
comment = "Testing out the LinkedIn Share API with JSON",
content = new
{
title = "Test post to LinkedIn",
submitted_url = "http://www.somewebsite.com",
submitted_image_url = "http://www.somewebsite.com/image.png"
},
visibility = new
{
code = "anyone"
}
};
RestClient rc = new RestClient(LinkedInAppInfo.LinkedInBaseApiUrl);
RestRequest request = new RestRequest(LinkedInAppInfo.SharePostPath, Method.POST);
request.RequestFormat = DataFormat.Json;
request.AddParameter("format", "json");
request.AddBody(shareMsg);
request.AddParameter("oauth2_access_token", accessToken, ParameterType.GetOrPost);
RestResponse restResponse = (RestResponse)rc.Execute(request);
ResponseStatus responseStatus = restResponse.ResponseStatus;
我得到的结果是:
{
"errorCode": 0,
"message": "Couldn't parse share document: error: Unexpected end of file after null",
"requestId": "06ZU78FUNW",
"status": 400,
"timestamp": 1363551953855
}
关于我做错了什么有什么想法吗?