0
我正在收到400 - 錯誤的請求。Urban Airship API V3推送請求 - 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();