问题描述
我使用的是城市飞艇和使用他们的REST API测试。我有谷歌云通讯
连接到城市飞艇账户和一个Android设备注册成功。结果
我可以成功地从城市飞艇仪表板上的接口发送测试邮件。
I'm using Urban Airship and testing using their REST API. I have Google Cloud Messaging
connected to the Urban Airship account, and one Android device registered successfully.
I can successfully send test messages from the the interface on the Urban Airship dashboard.
但是当我尝试使用REST API https://go.urbanairship.com/api/push/
与身体
But when I try using the REST API https://go.urbanairship.com/api/push/
with the body
{
"audience" : "all" ,
"device_types" : "all",
"notification" : {
"android": {
"alert" : "This is a broadcast."
}
}
}
我得到这个程序是没有配置的iOS推送一个
400错误的请求
响应
任何想法,为什么?
更新:清单的观众一节中的特定设备APID返回相同的结果。
UPDATE: Listing the specific device APID in the "audience" section returns the same result
推荐答案
你有什么是正确的,但是你需要包含以下HTTP头:
What you have is correct, however you need to include the following HTTP header:
Accept: "application/vnd.urbanairship+json; version=3;
有关初学者Ruby开发者,它可以像这样实现的:
For beginner Ruby developers, it can be achieved like this:
req = Net::HTTP::Post.new(uri.path)
req["Accept"] = "application/vnd.urbanairship+json; version=3;"
在,例如,张贴通知UrbanAirship。
When, e.g., posting a notification to UrbanAirship.
这篇关于城市飞艇Android的推动越来越"这个程序是没有配置的iOS推送QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!