HTTP上的不良要求。

发布于 2025-02-03 08:45:36 字数 886 浏览 1 评论 0原文

问候,感谢您倾向于这个问题!

我正在尝试让我的Discord机器人创建一个预定的公会活动。 参与者和与会者加入语音频道的日历活动。 我正在尝试通过对Discord的API进行帖子来实现这一目标,而我的错误失败了。 以下消息是通过邮递员测试产生的。

{
    "code": 50109,
    "message": "The request body contains invalid JSON."
}

由于该消息意味着我的JSON主体不存在。 以下是我要发送的JSON主体的版本!

{
  "name": "The Bot created this!!!",
  "privacy_level": 2,
  "scheduled_start_time": "2022-06-15T15:00:00+00:00",
  "description": "The Bot also described this!!",
  "channel_id": 980830611458426901,
  "entity_type": 2
}

我试图遵循API的文档,尽我所能,没有积极的结果! 如果您想遵循文档,请参见以下链接:

我肯定缺少某些东西或添加应该添加到JSON主体的东西 不同类型的!!!欢迎任何见解!

我知道并尝试了

  • 我的身份验证是可靠的,因为我能够获得所有事件。

  • JSON主体中数据的许多变体和类型声明。

不管您有什么见解,谢谢您的宝贵时间!

Greetings and thank you for tending to this question!

I am trying to have my Discord bot create a Scheduled Guild Event.
A Calendar event for players and attendees to join a voice channel.
I am trying to achieve that by doing a POST call to Discord's API, and I am failing with the following error.
The following message was produced from a Postman test.

{
    "code": 50109,
    "message": "The request body contains invalid JSON."
}

As the message implies something is off with my JSON body.
Below follows a version of the JSON body I am trying to send!

{
  "name": "The Bot created this!!!",
  "privacy_level": 2,
  "scheduled_start_time": "2022-06-15T15:00:00+00:00",
  "description": "The Bot also described this!!",
  "channel_id": 980830611458426901,
  "entity_type": 2
}

I tried to follow the API's documentation as perfect as I could with no positive results!!
If you wish to follow the documentation yourselves here's the link:
Create Guild Scheduled Event

I am definitely missing something or adding something that should be added to the JSON body
of a different type!!! Any insights welcome!

What I know and tried

  • My authentication is solid because I am able to GET all events present.

  • Many variations of single quotes '' and type declarations for the data in the JSON body.

Regardless of insights, Thank you for your time!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文