ShipEngine / shipengine-dotnet

The official ShipEngine SDK for C# and the .NET Framework
https://www.shipengine.com/docs/
Apache License 2.0
11 stars 11 forks source link

.NET Character Issue #85

Closed Tal-Owl closed 5 months ago

Tal-Owl commented 5 months ago

In my C# service for using the Tracking API I get what looks like escape characters in my response from ShipEngine.

My code:

        var client = new RestClient("https://api.shipengine.com/v1/tracking");
        client.DefaultTimeout = Timeout.InfiniteTimeSpan;
        var request = new RestRequest("?carrier_code=ups&tracking_number={ ** Some Tracking Number **}", Method.Get);
        request.AddHeader("Host", "api.shipengine.com");
        request.AddHeader("API-Key", "{** TEST_API_KEY **}");
        RestResponse response = client.ExecuteGet(request);

My result returns accurate data, but it appears to be formatted awkwardly:

"{\r\n \"tracking_number\": \"1Z.......\",\r\n \"tracking_url\": \"http://wwwapps.ups.com/WebTracking/processRequest?HTMLVersion=5.0&Requester=NES&AgreeToTermsAndConditions=yes&loc=en_US&tracknum=1Z.......\",\r\n \"status_code\": \"DE\",\r\n \"carrier_code\": \"ups\",\r\n \"carrier_id\": 3,\r\n \"carrier_detail_code\": \"FS\",\r\n \"status_description\": \"Delivered\",\r\n \"carrier_status_code\": \"D\",\r\n \"carrier_status_description\": \"Delivered\",\r\n \"ship_date\": \"2024-04-12T07:00:00Z\",\r\n \"estimated_delivery_date\": null,\r\n

I can deserialize into a dynamic object, but this seems off. Is it using my .NET environment and somehow replacing the carriage returns and new lines with their respective characters?