コード例 #1
0
ファイル: XpsRates.cs プロジェクト: ahwm/xps-shipping
        private XpsServices GetServices()
        {
            HttpWebRequest req = (HttpWebRequest)WebRequest.Create("https://xpsshipper.com/restapi/v1/customers/" + _customerId + "/services");

            req.Method      = "GET";
            req.ContentType = "application/json";
            req.Headers.Add("Authorization", "RSIS " + _apiKey);
            req.Accept = "application/json";

            using (HttpWebResponse resp = (HttpWebResponse)req.GetResponse())
                using (StreamReader sr = new StreamReader(resp.GetResponseStream()))
                    return(XpsServices.FromJson(sr.ReadToEnd()));
        }
コード例 #2
0
ファイル: XpsServices.cs プロジェクト: ahwm/xps-shipping
 public static string ToJson(this XpsServices self)
 {
     return(JsonConvert.SerializeObject(self, Converter.Settings));
 }