Exemplo n.º 1
0
        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()));
        }
Exemplo n.º 2
0
 public static string ToJson(this XpsServices self)
 {
     return(JsonConvert.SerializeObject(self, Converter.Settings));
 }