Example #1
0
        static async Task <Uri> CreateShipmentAsync(Shipment_EP newShipment)
        {
            string myString = newShipment.FormattedParameterString();
            HttpResponseMessage response = await client.PostAsync("shipments?" + myString, null);

            response.EnsureSuccessStatusCode();

            if (response.IsSuccessStatusCode)
            {
                // Parse the response body.
                var savedShipment = await response.Content.ReadAsAsync <Shipment_EP>();

                //var savedShipment = response.Content.ReadAsStringAsync().Result;
            }
            else
            {
                Console.WriteLine("{0} ({1})", (int)response.StatusCode, response.ReasonPhrase);
            }
            return(response.Headers.Location);
        }