Поделитесь Instagram Facebook , linkdin и другими постами
Hi i want to post message on linkdin,Facebbok and Instagram using asp.net C# / MVC Application I have tried many articles but didnot find any solution, please help me that how can i perform such task, please share if anyone have used such implementation
Что я уже пробовал:
private string linkedinSharesEndPoint = "https://api.linkedin.com/v1/people/~/shares?oauth2_access_token={0}"; private const string defaultUrl = "https://www.linkedin.com/in/futuresoft-india-b9b1931bb/"; private const string defaultImageUrl = "some-image-url"; string accessToken = ""; string title = "Post Test"; protected void Page_Load(object sender, EventArgs e) { bool r= PostLinkedInNetworkUpdate( accessToken, title, defaultUrl, defaultImageUrl); if(r) { string s = "sucess"; } } public bool PostLinkedInNetworkUpdate(string accessToken, string title, string submittedUrl = defaultUrl, string submittedImageUrl = defaultImageUrl) { var requestUrl = String.Format(linkedinSharesEndPoint, accessToken); var message = new { comment = "Testing out the LinkedIn Share API with JSON", content = new Dictionary<string, string> { { "title", title }, { "submitted-url", submittedUrl }, {"submitted-image-url" , submittedImageUrl} }, visibility = new { code = "anyone" } }; var requestJson = new JavaScriptSerializer().Serialize(message); var client = new WebClient(); var requestHeaders = new NameValueCollection { { "Content-Type", "application/json" }, { "x-li-format", "json" } }; client.Headers.Add(requestHeaders); var responseJson = client.UploadString(requestUrl, "POST", requestJson); var response = new JavaScriptSerializer().Deserialize<Dictionary<string, object>>(responseJson); return response.ContainsKey("updateKey"); } } I have use this but when i posting, i am getting 401 error(Authincation error)
Gerry Schmitz
Сделайте то же самое для других 2.
Richard MacCutchan
Вам нужно проверить, что ваши значения аутентификации верны для веб-сайта и их API. Не то, что кто-то здесь может сделать для вас.