简体   繁体   English

发布到Linkedin Groups API 400错误请求

[英]Post to Linkedin Groups API 400 Bad Request

I'm getting a 400 Bad Request Posting my JSON to the Groups API. 我收到一个400错误的请求,将我的JSON发布到网上论坛API。 I'm assuming it's because my JSON for the post is formatted incorrectly. 我认为这是因为帖子的JSON格式不正确。 Wondering if anyone has posted successfully to the groups API and could provide some assistance. 想知道是否有人已经成功发布到网上论坛API并可以提供一些帮助。 The XML example indicates surrounding the content. XML示例指示内容周围。 Do I need to include post? 我需要包括帖子吗?

Here's my JSON 这是我的JSON

{\"title\":\"Testing out the LinkedIn Share API with JSON\",\"content\":{\"title\":\"News Article\",\"submitted-url\":\"http%3a%2f%2fmysite.com%2fcontent.aspx%3fpage_id%3d5%26club_id%3d652588%26item_id%3d300\",\"description\":\"hey this is a description\"}}

Here's the object I'm using to build it: 这是我用来构建它的对象:

var post = new {
title = "Testing out the LinkedIn Share API with JSON",
content = new Dictionary<string, string>
  { { "title", title },
  { "submitted-url", encodedUrl },
  {"description" , postdescription}
    }
};

Would an improperly formatted JSON object trip a 400 Bad Request Error? 格式不正确的JSON对象会引发400错误请求错误吗?

This is resolved. 解决了。 My Json string was messed up. 我的Json琴弦弄乱了。 "Post" and some {}'s were missing. 缺少“帖子”和一些{}。

If anyone ends up reading this, also make sure your URL's are encoded. 如果有人最终阅读了这篇文章,还请确保您的URL已编码。 Test your json and example strings in the REST console here: 在REST控制台中测试您的json和示例字符串:

https://developer.linkedin.com/rest-console . https://developer.linkedin.com/rest-console

Some other tips, to save yourself some time - don't take any documentation/support posts or google'd solutions seriously if they're previous to 2013. There's some really bad/ugly stuff floating around that should just be deleted. 其他一些技巧,以节省一些时间-如果早于2013年,请不要认真对待任何文档/支持文章或Google解决方案。有一些非常糟糕/丑陋的东西应该删除。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM