错误:无效的JSON架构 [英] Error: invalid JSON schema
本文介绍了错误:无效的JSON架构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用API在我的推特墙上发布。但是我收到了错误。
这里是我的代码:
i am trying to post on my twitter wall using a API.but i got an error.
here is my code:
var client = new RestClient("https://platform.hootsuite.com/v1/messages");
var request = new RestRequest(Method.POST);
request.AddHeader("Postman-Token", "xxxxxxxx-xxxx-xxx-xxxx-xxxxxxxxx");
request.AddHeader("Cache-Control", "no-cache");
request.AddHeader("Authorization", "Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxx");
request.AddHeader("text", "Message Schedule");
request.AddHeader("socialProfileIds", "xxxxxxxx");
request.AddHeader("scheduledSendTime", "2018-07-27 17:30:00");
request.AddHeader("emailNotification", "false");
IRestResponse response = client.Execute(request);
我的尝试:
在邮递员应用程序上运行代码,但得到相同的错误。并没有找到任何解决方案..任何人都建议我的解决方案。
What I have tried:
run code on postman app but getting same error. and not find any solution of it.. any one suggest me the solution.
推荐答案
您的请求没有附加数据;你把所有东西作为标题加载。这可能很容易导致您看到的错误。
应该通过以下方式添加要作为请求有效负载的一部分而不是标头的项目:
You have no data attached to your request; you're loading everything as a header. That could easily result in the error that you're seeing.
Items that are meant to be part of the request payload, not the headers, should be added via:
request.AddParameter("text", "Message Schedule");
request.AddParameter("socialProfileIds", "xxxxxxxx");
request.AddParameter("scheduledSendTime", "2018-07-27 17:30:00");
request.AddParameter("emailNotification", "false");
它看起来像RestSharp API期望以不同方式处理身份验证,这可能会干扰您的测试。
阅读文档:
主页·restsharp / RestSharp Wiki·GitHub [ ^ ]
这篇关于错误:无效的JSON架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文