OneSignal REST API发送推送通知,但我收到500错误

时间:2016-11-22 11:33:09

标签: onesignal

我已经编写了一个Perl脚本,并且我尝试使用 OneSignal 发送测试推送通知。这是我的 JSON (为了便于阅读而美化);

 {
    "contents": {
        "en": "Here are your daily picks!"
    },
    "app_id": "id_here",
    "app_ids": ["id_here"],
    "include_player_ids": ["aabaa581-b54a-4348-81cb-00ed65c1adf8"]
 }

我收到一条错误消息,用纯HTML格式显示:

  <p id="message" class="text">An Unexpected Error Occurred</p>
  <p id="submessage" class="text">Error Code: 500</p>
  <p id="explanation" class="text">
    We track these errors automatically, but if the problem persists feel free to contact us.
  </p>

关于我做错了什么的任何想法?

1 个答案:

答案 0 :(得分:2)

啊,我已经知道了!我会在这里提出答案,以防其他人在将来遇到同样的问题。基本上,您需要同时提供1app_id AND app_ids`参数。文档有点误导:

https://documentation.onesignal.com/reference#create-notification

enter image description here

如果您只是使用app_id,那么它会发送罚款:)