0
我在過去的一年中使用了postmates交付報價API,而且在我檢查時它運行良好。Postmates API不起作用
但現在似乎不靈
它拋出一個異常,用一些使餅乾和驗證碼的HTML文本
如果我失蹤postmates
一些更新我無法理解這裏是我的編碼
HttpWebRequest req = WebRequest.Create(new Uri("https://api.postmates.com/v1/customers/" + PostmatesCustomerId + "/delivery_quotes")) as HttpWebRequest;
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.Headers.Add("Authorization", "Basic " + Base64string);
StringBuilder paramz = new StringBuilder();
paramz.Append("pickup_address=" + PickUpAddress + "&dropoff_address=" + DeliveryAddress);
byte[] formData =
UTF8Encoding.UTF8.GetBytes(paramz.ToString());
req.ContentLength = formData.Length;
// Send the request:
using (Stream post = req.GetRequestStream())
{
post.Write(formData, 0, formData.Length);
}
string responseString = null;
using (HttpWebResponse resp = req.GetResponse()
as HttpWebResponse)
{
StreamReader reader =
new StreamReader(resp.GetResponseStream());
responseString = reader.ReadToEnd();
}