Urban Airship API V3推送请求 - 400错误请求

时间:2015-08-23 03:40:16

标签: urbanairship.com

我收到400 - 请求不好。

这是我的要求:

{     "观众" :{         "标签":[" 994c4298-89ba-4715-879d-10540fcf0059"," a82e8789-3239-4899-b6dc-1e6a71dc06d4"]         },     "通知":{             "警告":" 8月19日测试",             "额外":{" NewsID":" 127"}         },     " device_types":"所有" }

这是我的代码:

   using (var client = new WebClient())
                string PostData = "I am assigining above json string here";
                UTF8Encoding encoding = new UTF8Encoding();
                var dataToPost = encoding.GetBytes(PostData);
                client.Headers[HttpRequestHeader.ContentType] = "application/json";                                        
                client.Headers.Add(HttpRequestHeader.Accept,"application/vnd.urbanairship+json; version=3;");                    
                //client.Headers[HttpRequestHeader.Accept] = "application/vnd.urbanairship+json; version=3";
                client.Credentials = new NetworkCredential("App key", "Master key");
                var result = client.UploadData("https://go.urbanairship.com/api/push/", "POST", dataToPost);

                Stream stream = new MemoryStream(result);
                StreamReader reader = new StreamReader(stream);
                string text = reader.ReadToEnd();

1 个答案:

答案 0 :(得分:0)

当我将“tags”更改为“tag”并将“extra”添加到“ios”中时工作:{“extra”:“blah blah blah”}

我认为他们已经在V3中做出了这些改变。

感谢。