发布到Linkedin Groups API 400 Bad Request

时间:2014-07-26 03:39:49

标签: c# json rest linkedin

我收到400错误请求将我的JSON发布到Groups API。我假设它是因为我的帖子的JSON格式不正确。想知道是否有人成功发布到群组API并且可以提供一些帮助。 XML示例表示围绕内容。我需要包含帖子吗?

这是我的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\"}}

这是我用来构建它的对象:

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

格式不正确的JSON对象是否会导致400 Bad Request Error?

1 个答案:

答案 0 :(得分:0)

这已经解决了。我的Json字符串搞砸了。 &#34;邮政&#34;还有一些{}失踪了。

如果有人最终阅读此内容,请确保您的网址已被编码。在这里测试你的json和示例字符串在REST控制台中:

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

其他一些提示,为了节省一些时间 - 如果他们在2013年之前就不会认真对待任何文档/支持帖子或谷歌搜索解决方案。那里有一些非常糟糕的/丑陋的东西应该被删除。