shipengine / shipengine-dotnet Goto Github PK
View Code? Open in Web Editor NEWThe official ShipEngine SDK for C# and the .NET Framework
Home Page: https://www.shipengine.com/docs/
License: Apache License 2.0
The official ShipEngine SDK for C# and the .NET Framework
Home Page: https://www.shipengine.com/docs/
License: Apache License 2.0
Hi there,
Seem to be running into an issue with the CreateLabelFromShipmentDetails function, specifically when including the custom object in the shipping object.
contents and nondelivery fields seem to be ignored and excluded from the request to the shipengine API
Enum.TryParse("US", out ShipEngineSDK.Common.Enums.Country fromCountryEnum);
Enum.TryParse("US", out ShipEngineSDK.Common.Enums.Country toCountryEnum);
var request = new ShipEngineSDK.CreateLabelFromShipmentDetails.Params
{
Shipment = new ShipEngineSDK.CreateLabelFromShipmentDetails.Shipment
{
ServiceCode = "usps_first_class_mail",
ShipTo = new ShipEngineSDK.Common.Address
{
AddressLine1 = "777 Brockton Avenue",
AddressLine2 = string.Empty,
CityLocality = "Abington",
StateProvince = "MA",
CountryCode = toCountryEnum,
PostalCode = "02351",
Name = "Jack Jones",
Phone = "+44123456789",
AddressResidentialIndicator = ShipEngineSDK.Common.Enums.AddressResidentialIndicator.Unknown
},
ShipFrom = new ShipEngineSDK.Common.Address
{
AddressLine1 = "777 Brockton Avenue",
AddressLine2 = string.Empty,
CityLocality = "Abington",
StateProvince = "MA",
CountryCode = fromCountryEnum,
PostalCode = "02351",
Name = "Jack Jones",
Phone = "+44123456789",
AddressResidentialIndicator = ShipEngineSDK.Common.Enums.AddressResidentialIndicator.Unknown
},
Customs = new ShipEngineSDK.CreateLabelFromShipmentDetails.InternationalShipmentOptions
{
Contents = ShipEngineSDK.Common.Enums.PackageContents.Merchandise,
NonDelivery = ShipEngineSDK.Common.Enums.NonDelivery.ReturnToSender
},
Packages = new List<ShipEngineSDK.CreateLabelFromShipmentDetails.Package>
{
new ShipEngineSDK.CreateLabelFromShipmentDetails.Package
{
Weight = new ShipEngineSDK.Common.Weight
{
Unit = ShipEngineSDK.Common.Enums.WeightUnit.Gram,
Value = 50
}
}
},
},
LabelDownloadType = ShipEngineSDK.CreateLabelFromShipmentDetails.LabelDownloadType.Inline,
LabelLayout = ShipEngineSDK.Common.Enums.LabelLayout.FourBySix
};
{"shipment":{"service_code":"usps_first_class_mail","ship_to":{"name":"Jack Jones","phone":"+44123456789","address_line1":"777 Brockton Avenue","address_line2":"","city_locality":"Abington","state_province":"MA","postal_code":"02351","country_code":"US","address_residential_indicator":"unknown"},"ship_from":{"name":"Jack Jones","phone":"+44123456789","address_line1":"777 Brockton Avenue","address_line2":"","city_locality":"Abington","state_province":"MA","postal_code":"02351","country_code":"US","address_residential_indicator":"unknown"},"customs":{},"packages":[{"weight":{"value":50.0,"unit":"Gram"}}]},"label_download_type":"Inline","label_layout":"4x6"}
As you can see, the customs object is empty and the response from the API is as follows:
{
"request_id": "5f8c0c43-ff75-4a35-9d19-3af54bcc061b",
"errors": [
{
"error_source": "shipengine",
"error_type": "system",
"error_code": "unspecified",
"message": "request.shipment.customs: Required property 'contents' not found in JSON. Path 'shipment.customs', line 1, position 556.,Required property 'non_delivery' not found in JSON. Path 'shipment.customs', line 1, position 556."
}
]
}
The fix for this seems to be to remove this line from JsonSerializerSettings
DefaultValueHandling = DefaultValueHandling.Ignore,
However, I am unsure if this change would affect anything else.
Removing this line from the serializer ends up with the same request succeeding and includes the correct customs object.
The new request:
{"shipment":{"service_code":"usps_first_class_mail","ship_to":{"name":"Jack Jones","phone":"+44123456789","address_line1":"777 Brockton Avenue","address_line2":"","city_locality":"Abington","state_province":"MA","postal_code":"02351","country_code":"US","address_residential_indicator":"unknown"},"ship_from":{"name":"Jack Jones","phone":"+44123456789","address_line1":"777 Brockton Avenue","address_line2":"","city_locality":"Abington","state_province":"MA","postal_code":"02351","country_code":"US","address_residential_indicator":"unknown"},"confirmation":"None","customs":{"contents":"Merchandise","non_delivery":"return_to_sender"},"origin_type":"Pickup","insurance_provider":"None","order_source_code":"amazon_ca","packages":[{"weight":{"value":50.0,"unit":"Gram"}}]},"is_return_label":false,"charge_event":"carrier_default","validate_address":"no_validation","label_download_type":"Inline","label_format":"PDF","display_scheme":"Label","label_layout":"4x6"}
The new response:
{
"label_id": "se-85929873",
"status": "completed",
"shipment_id": "se-165398253",
"ship_date": "2021-09-23T00:00:00Z",
"created_at": "2021-09-23T11:26:11.0263725Z",
"shipment_cost": {
"currency": "usd",
"amount": 3.0100
},
"insurance_cost": {
"currency": "usd",
"amount": 0.0
},
"tracking_number": "9400111899560208307472",
"is_return_label": false,
"rma_number": null,
"is_international": false,
"batch_id": "",
"carrier_id": "se-746201",
"service_code": "usps_first_class_mail",
"package_code": "package",
"voided": false,
"voided_at": null,
"label_format": "pdf",
"display_scheme": "label",
"label_layout": "4x6",
"trackable": true,
"label_image_id": null,
"carrier_code": "stamps_com",
"tracking_status": "in_transit",
"label_download": {
"href": "data:application/pdf;base64,JVBERi0xLjQKJeLjz9MKMiAwIG9iago8PC9MZW5ndGggNDkvRmlsdGVyL0ZsYXRlRGVjb2RlPj5zdHJlYW0KeJwr5HIK4TI2UzC2NFMISeFyDeEK5CpUMFQwAEIImZyroB+RZqjgkq8QyAUA6zUJ9gplbmRzdHJlYW0KZW5kb2JqCjQgMCBvYmoKPDwvVHlwZS9QYWdlL01lZGlhQm94WzAgMCAyNzQuNDYgNDMyXS9SZXNvdXJjZXM8PC9Qcm9jU2V0IFsvUERGIC9UZXh0IC9JbWFnZUIgL0ltYWdlQyAvSW1hZ2VJXS9YT2JqZWN0PDwvWGYxIDEgMCBSPj4+Pi9Db250ZW50cyAyIDAgUi9QYXJlbnQgMyAwIFI+PgplbmRvYmoKMSAwIG9iago8PC9GaWx0ZXIvRmxhdGVEZWNvZGUvTGVuZ3RoIDEzODEvUmVzb3VyY2VzPDwvRm9udDw8L0ZhYmM3IDUgMCBSL0ZhYmM5IDYgMCBSL0YwIDcgMCBSPj4vWE9iamVjdDw8L0lhYmMxMCA4IDAgUi9JYWJjMTcgOSAwIFI+Pj4+L1R5cGUvWE9iamVjdC9TdWJ0eXBlL0Z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mNmYzY2RjMWNlMDY4Pl0+PgpzdGFydHhyZWYKNDE0MgolJUVPRgo="
},
"form_download": null,
"insurance_claim": null,
"packages": [
{
"package_id": 91134147,
"package_code": "package",
"weight": {
"value": 50.00,
"unit": "gram"
},
"dimensions": {
"unit": "inch",
"length": 0.0,
"width": 0.0,
"height": 0.0
},
"insured_value": {
"currency": "usd",
"amount": 0.00
},
"tracking_number": "9400111899560208307472",
"label_messages": {
"reference1": null,
"reference2": null,
"reference3": null
},
"external_package_id": null,
"sequence": 1
}
],
"charge_event": "carrier_default"
}
Hopefully, this helps!
Note: this is all done with the sandbox environment, unsure if production behaves differently.
Seems this library has no support for ShipEngine webhooks!
Hi Devs,
I'm having trouble with this API: getRatesWithShipmentDetails
I'm calling it like this:
const shipEngineResults = await shipengine.getRatesWithShipmentDetails(shippingInfo);
where shippingInfo = {
rateOptions: {
carrierIds: [ 'se-2884143', 'se-2884144', 'se-2884146' ],
serviceCodes: []
},
shipment: {
validateAddress: 'validate_only',
confirmation: 'none',
shipFrom: {
name: 'Tom Hanks',
phone: '7146129169',
postalCode: '93306',
companyName: 'Test Company',
countryCode: 'US',
addressLine1: '3218 Kaibab Avenue',
addressLine2: '',
cityLocality: 'Bakersfield',
stateProvince: 'CA',
addressResidentialIndicator: 'no'
},
shipTo: {
name: 'Nxtlives Dev',
phone: null,
addressLine1: '800 W 6th St',
addressLine2: null,
cityLocality: 'Los Angeles',
stateProvince: 'CA',
countryCode: 'US',
postalCode: '90017'
},
packages: [ [Object] ]
}
}
Sometimes I get the error saying {
err: ShipEngineError: The ShipEngine /v1/rates API timed out.
at sendRequestWithRetry (/Users/wentaozhou/Documents/GitHub/nextsite_server/node_modules/shipengine/cjs/client/index.js:44:23)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.post (/Users/wentaozhou/Documents/GitHub/nextsite_server/node_modules/shipengine/cjs/client/index.js:14:12)
at async Object.getRatesWithShipmentDetails (/Users/wentaozhou/Documents/GitHub/nextsite_server/node_modules/shipengine/cjs/get-rates-with-shipment-details/index.js:17:22)
at async itemShipping (file:///Users/wentaozhou/Documents/GitHub/nextsite_server/utils/order.js:1109:31)
at async file:///Users/wentaozhou/Documents/GitHub/nextsite_server/controllers/orderController.js:1579:26
at async Promise.all (index 0)
at async get_cart_shipping (file:///Users/wentaozhou/Documents/GitHub/nextsite_server/controllers/orderController.js:1569:23) {
source: 'shipengine',
type: 'system',
code: 'timeout',
requestID: undefined,
url: URL {
href: 'https://www.shipengine.com/docs/errors/codes/',
origin: 'https://www.shipengine.com/',
protocol: 'https:',
username: '',
password: '',
host: 'www.shipengine.com',
hostname: 'www.shipengine.com',
port: '',
pathname: '/docs/errors/codes/',
search: '',
searchParams: URLSearchParams {},
hash: ''
}
}
}
Please note that this error does not happen every time I call it using the same json input. I would say there's a 50% chance that the error occurs, and other times the call is successful. do you know why this occurs?
Thanks,
Wentao Zhou
Seems like some kind of mapping/serialization issue. I'm using ShipEngine nuget package v 1.0.1.
Here is my code, using .net6/vs2022:
var shipEngine = new ShipEngine(shipEngineApiKey);
var carriers = await shipEngine.ListCarriers();
"carriers" is returning a JsonException:
System.Text.Json.JsonException: A possible object cycle was detected. This can either be due to a cycle or if the object depth is larger than the maximum allowed depth of 32. Consider using ReferenceHandler.Preserve on JsonSerializerOptions to support cycles. Path: $.MoveNextAction.Target.MoveNextAction.Target.MoveNextAction.Target.MoveNextAction.Target.MoveNextAction.Target.MoveNextAction.Target.MoveNextAction.Target.MoveNextAction.Target.MoveNextAction.Target.MoveNextAction.Target.MoveNextAction.Target.MoveNextAction.Target.MoveNextAction.Target.MoveNextAction.Target.MoveNextAction.Target.MoveNextAction.Target.
I downloaded the C# SDK and noticed it has several Nuget packages that are outdated and have reported vulnerabilities.
Also, the .NET target version is out of support. Is it ok to upgrade these and still use the SDK?
I am reviewing your services and process approximately 10,000 labels a month.
See image below, I use Visual Studio 2022 with the latest .Net framework.
It looks like the Open API specs have been updated with the new support for dangerous goods, but not this .NET library? Are there plans to support that in this library?
Hello, it seems that delivery_days is defined as non-nullable in your API but my web service call (via this SDK) is erroring in the test environment.
Error converting value {null} to type 'System.Int32'. Path 'rate_response.rates[2].delivery_days', line 106, position 29.
at ShipEngineSDK.ShipEngineClient.d__51.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter
1.GetResult()
at ShipEngineSDK.ShipEngine.d__18.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
Note that the addresses and accounts here are fake/test accounts
Request: {"shipment":{"ship_to":{"name":"Steve","address_line1":"123 Main St","city_locality":"South Lyon","state_province":"MI","postal_code":"48111","country_code":"US","address_residential_indicator":"no"},"ship_from":{"name":"Steve","phone":"248-224-4668","address_line1":"123 Main St","city_locality":"South Lyon","state_province":"MI","postal_code":"48111","country_code":"US","address_residential_indicator":"no"},"packages":[{"weight":{"value":7.5,"unit":"Pound"}}]},"rate_options":{"carrier_ids":["se-769864","se-769863"]}}
Response: HTTP/1.1 200 OK
{
"rate_response": {
"rates": [
{
"rate_id": "se-911782738",
"rate_type": "shipment",
"carrier_id": "se-769863",
"shipping_amount": {
"currency": "usd",
"amount": 25.91
},
"insurance_amount": {
"currency": "usd",
"amount": 0.0
},
"confirmation_amount": {
"currency": "usd",
"amount": 0.0
},
"other_amount": {
"currency": "usd",
"amount": 0.00
},
"zone": null,
"package_type": null,
"delivery_days": 3,
"guaranteed_service": true,
"estimated_delivery_date": "2021-10-04T00:00:00Z",
"carrier_delivery_days": null,
"ship_date": "2021-10-01T00:00:00Z",
"negotiated_rate": false,
"service_type": "UPS 3 Day Select®",
"service_code": "ups_3_day_select",
"trackable": true,
"carrier_code": "ups",
"carrier_nickname": "ShipEngine Test Account - UPS",
"carrier_friendly_name": "UPS",
"validation_status": "valid",
"warning_messages": [
"Ship To Address Classification is changed from Commercial to Residential"
],
"error_messages": []
},
{
"rate_id": "se-911782739",
"rate_type": "shipment",
"carrier_id": "se-769863",
"shipping_amount": {
"currency": "usd",
"amount": 87.94
},
"insurance_amount": {
"currency": "usd",
"amount": 0.0
},
"confirmation_amount": {
"currency": "usd",
"amount": 0.0
},
"other_amount": {
"currency": "usd",
"amount": 0.00
},
"zone": null,
"package_type": null,
"delivery_days": 1,
"guaranteed_service": true,
"estimated_delivery_date": "2021-10-02T00:00:00Z",
"carrier_delivery_days": null,
"ship_date": "2021-10-01T00:00:00Z",
"negotiated_rate": false,
"service_type": "UPS Next Day Air® Early",
"service_code": "ups_next_day_air_early_am",
"trackable": true,
"carrier_code": "ups",
"carrier_nickname": "ShipEngine Test Account - UPS",
"carrier_friendly_name": "UPS",
"validation_status": "valid",
"warning_messages": [
"Ship To Address Classification is changed from Commercial to Residential"
],
"error_messages": []
},
{
"rate_id": "se-911782740",
"rate_type": "shipment",
"carrier_id": "se-769863",
"shipping_amount": {
"currency": "usd",
"amount": 17.51
},
"insurance_amount": {
"currency": "usd",
"amount": 0.0
},
"confirmation_amount": {
"currency": "usd",
"amount": 0.0
},
"other_amount": {
"currency": "usd",
"amount": 0.00
},
"zone": null,
"package_type": null,
"delivery_days": null,
"guaranteed_service": false,
"estimated_delivery_date": null,
"carrier_delivery_days": null,
"ship_date": "2021-10-01T00:00:00Z",
"negotiated_rate": false,
"service_type": "UPS® Ground",
"service_code": "ups_ground",
"trackable": true,
"carrier_code": "ups",
"carrier_nickname": "ShipEngine Test Account - UPS",
"carrier_friendly_name": "UPS",
"validation_status": "valid",
"warning_messages": [
"Ship To Address Classification is changed from Commercial to Residential"
],
"error_messages": []
},
{
"rate_id": "se-911782741",
"rate_type": "shipment",
"carrier_id": "se-769863",
"shipping_amount": {
"currency": "usd",
"amount": 52.24
},
"insurance_amount": {
"currency": "usd",
"amount": 0.0
},
"confirmation_amount": {
"currency": "usd",
"amount": 0.0
},
"other_amount": {
"currency": "usd",
"amount": 0.00
},
"zone": null,
"package_type": null,
"delivery_days": 1,
"guaranteed_service": true,
"estimated_delivery_date": "2021-10-02T00:00:00Z",
"carrier_delivery_days": null,
"ship_date": "2021-10-01T00:00:00Z",
"negotiated_rate": false,
"service_type": "UPS Next Day Air Saver®",
"service_code": "ups_next_day_air_saver",
"trackable": true,
"carrier_code": "ups",
"carrier_nickname": "ShipEngine Test Account - UPS",
"carrier_friendly_name": "UPS",
"validation_status": "valid",
"warning_messages": [
"Ship To Address Classification is changed from Commercial to Residential"
],
"error_messages": []
},
{
"rate_id": "se-911782742",
"rate_type": "shipment",
"carrier_id": "se-769863",
"shipping_amount": {
"currency": "usd",
"amount": 55.17
},
"insurance_amount": {
"currency": "usd",
"amount": 0.0
},
"confirmation_amount": {
"currency": "usd",
"amount": 0.0
},
"other_amount": {
"currency": "usd",
"amount": 0.00
},
"zone": null,
"package_type": null,
"delivery_days": 1,
"guaranteed_service": true,
"estimated_delivery_date": "2021-10-02T00:00:00Z",
"carrier_delivery_days": null,
"ship_date": "2021-10-01T00:00:00Z",
"negotiated_rate": false,
"service_type": "UPS Next Day Air®",
"service_code": "ups_next_day_air",
"trackable": true,
"carrier_code": "ups",
"carrier_nickname": "ShipEngine Test Account - UPS",
"carrier_friendly_name": "UPS",
"validation_status": "valid",
"warning_messages": [
"Ship To Address Classification is changed from Commercial to Residential"
],
"error_messages": []
},
{
"rate_id": "se-911782743",
"rate_type": "shipment",
"carrier_id": "se-769863",
"shipping_amount": {
"currency": "usd",
"amount": 33.25
},
"insurance_amount": {
"currency": "usd",
"amount": 0.0
},
"confirmation_amount": {
"currency": "usd",
"amount": 0.0
},
"other_amount": {
"currency": "usd",
"amount": 0.00
},
"zone": null,
"package_type": null,
"delivery_days": 2,
"guaranteed_service": true,
"estimated_delivery_date": "2021-10-04T00:00:00Z",
"carrier_delivery_days": null,
"ship_date": "2021-10-01T00:00:00Z",
"negotiated_rate": false,
"service_type": "UPS 2nd Day Air®",
"service_code": "ups_2nd_day_air",
"trackable": true,
"carrier_code": "ups",
"carrier_nickname": "ShipEngine Test Account - UPS",
"carrier_friendly_name": "UPS",
"validation_status": "valid",
"warning_messages": [
"Ship To Address Classification is changed from Commercial to Residential"
],
"error_messages": []
}
],
"invalid_rates": [],
"rate_request_id": "se-103446263",
"shipment_id": "se-168945144",
"created_at": "2021-10-01T14:13:09.7170675Z",
"status": "partial",
"errors": [
{
"error_source": "shipengine",
"error_type": "business_rules",
"error_code": "unspecified",
"message": "A shipping carrier error occurred: Could not find endpoint element with name 'RateServicePort.Sandbox' and contract 'FedExRate.v28.RatePortType' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this name could be found in the client element.",
"carrier_id": "se-769864",
"carrier_code": "fedex",
"carrier_name": "FedEx"
},
{
"error_source": "shipengine",
"error_type": "business_rules",
"error_code": "unspecified",
"message": "A shipping carrier error occurred: Could not find endpoint element with name 'RateServicePort.Sandbox' and contract 'FedExRate.v28.RatePortType' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this name could be found in the client element.",
"carrier_id": "se-769864",
"carrier_code": "fedex",
"carrier_name": "FedEx"
}
]
},
"shipment_id": "se-168945144",
"carrier_id": null,
"service_code": null,
"external_shipment_id": null,
"ship_date": "2021-10-01T00:00:00Z",
"created_at": "2021-10-01T14:13:09.05Z",
"modified_at": "2021-10-01T14:13:09.04Z",
"shipment_status": "pending",
"ship_to": {
"name": "Steve",
"phone": null,
"company_name": null,
"address_line1": "123 Main St",
"address_line2": null,
"address_line3": null,
"city_locality": "South Lyon",
"state_province": "MI",
"postal_code": "48111",
"country_code": "US",
"address_residential_indicator": "no"
},
"ship_from": {
"name": "Steve",
"phone": "248-224-4668",
"company_name": null,
"address_line1": "123 Main St",
"address_line2": null,
"address_line3": null,
"city_locality": "South Lyon",
"state_province": "MI",
"postal_code": "48111",
"country_code": "US",
"address_residential_indicator": "unknown"
},
"warehouse_id": null,
"return_to": {
"name": "Steve",
"phone": "248-224-4668",
"company_name": null,
"address_line1": "123 Main St",
"address_line2": null,
"address_line3": null,
"city_locality": "South Lyon",
"state_province": "MI",
"postal_code": "48111",
"country_code": "US",
"address_residential_indicator": "unknown"
},
"confirmation": "none",
"customs": {
"contents": "merchandise",
"customs_items": [],
"non_delivery": "return_to_sender"
},
"external_order_id": null,
"order_source_code": null,
"advanced_options": {
"bill_to_account": null,
"bill_to_country_code": null,
"bill_to_party": null,
"bill_to_postal_code": null,
"contains_alcohol": false,
"delivered_duty_paid": false,
"non_machinable": false,
"saturday_delivery": false,
"dry_ice": false,
"dry_ice_weight": null,
"fedex_freight": null,
"freight_class": null,
"custom_field1": null,
"custom_field2": null,
"custom_field3": null,
"collect_on_delivery": null,
"return_pickup_attempts": null
},
"insurance_provider": "none",
"tags": [],
"packages": [
{
"package_code": "package",
"weight": {
"value": 7.50,
"unit": "pound"
},
"dimensions": {
"unit": "inch",
"length": 0.0,
"width": 0.0,
"height": 0.0
},
"insured_value": {
"currency": "usd",
"amount": 0.00
},
"label_messages": {
"reference1": null,
"reference2": null,
"reference3": null
},
"external_package_id": null
}
],
"total_weight": {
"value": 7.50,
"unit": "pound"
},
"items": []
}
With the new SDK, is the plan going forward to not support .NET Framework 4, 4.5+ and to only support .NET Standard?
Rate request issue with the combination of "service_codes" and "ups_worldwide_saver" service. Please refer to the details of Zendesk ticket 3710055 with ShipEngine Support.
Our QA team can't finish end to end testing and we need to do that to go live.
Thanks for your help.
Hello,
How to implement tracking for multiple tracking numbers at once ?
I need to send only one query with many tracking numbers, is it possible ?
I've identified the following country code as missing from the ShipEngineSDK.Common.Enums.Country enum. I am not sure if these should be missing because they are unsupported of it is an oversight that they are missing.
I am integrating UPS API for Shipengine. In my programming i have to charge to client based on Zone provided by UPS. I need some API by which i know Zone from sender and recipient address. I know UPS is giving option to download file which give zone details from link https://www.ups.com/us/en/support/shipping-support/shipping-costs-rates/retail-rates.page. But if i have to integrate all zones of US then i have to download more then 900 files. Is any option to get list of zones though any API or though any download option.
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?
Will there be support in the future for other methods such as "UPSAccountCarrierConnectAccount"?
We have an application that uses RecognizeAddressRequestDTO and NLPRecognizeAddress to parse an address. The result is incorrect.
RecognizeAddressRequestDTO ("Customer name, P.A." & vbCrLf & "P. O. Box 999999" & vbCrLf & "Orlando, FL 33333-9999")
The parseaddress contains incorrect data. Can someone help?
Hi
I am using React with Axios to communicate with ShipEngine API. It keeps giving AxiosError, code 'ERR_NETWORK'.
I have no issue when using Postman. I have no issue communication with ShipStation API. Not sure the reason for this issue. Any help will be appreciated.
I have been attempting to validate an address using the .NET SDK, however when the detail_code field of an address validation message is null, I get the following exception:
Error converting value {null} to type 'ShipEngineSDK.ValidateAddresses.ValidationMessageDetailCode'
Most likely, the detail_code is not marked as nullable in the schema, and this breaks the validation deserialization.
Hello Devs,
I'm having an issue with this API: GetRatesWithShipmentDetails, when I create a shipping to Mexico
I'm calling it like this:
{
"ShipmentId": null,
"Shipment": {
"ValidateAddress": "no_validation",
"CarrierId": "se-2264604",
"ServiceCode": null,
"ExternalOrderId": null,
"Items": null,
"TaxIdentifiers": null,
"ExternalShipmentId": "302594bf-791e-471d-986b-b99345d331ad",
"ShipDate": "2023-07-17T13:43:45Z",
"ShipTo": {
"Name": "TEST MEXICO",
"Phone": "",
"CompanyName": "",
"AddressLine1": "AVE INTERNACIONAL 5702",
"AddressLine2": "",
"AddressLine3": null,
"CityLocality": "SINALOA",
"StateProvince": "",
"PostalCode": "82180",
"CountryCode": "MX",
"AddressResidentialIndicator": "yes"
},
"ShipFrom": null,
"WarehouseId": "se-6555950",
"ReturnTo": null,
"Confirmation": "None",
"Customs": {
"Contents": "Merchandise",
"NonDelivery": "return_to_sender",
"CustomsItems": [
{
"Description": "Vitamins",
"Quantity": 1,
"Value": {
"Currency": "USD",
"Amount": 10.5
},
"HarmonizedTariffCode": "30045099",
"CountryOfOrigin": "US",
"UnitOfMeasure": null,
"Sku": "01778",
"SkuDescription": "Super Selenium Complex, 200 mc "
}
]
},
"AdvancedOptions": null,
"OriginType": 0,
"InsuranceProvider": "None",
"Tags": null,
"OrderSourceCode": "amazon_ca",
"Packages": [
{
"PackageCode": "custom_Box1",
"Weight": {
"Value": 1,
"Unit": "Pound"
},
"Dimensions": null,
"InsuredValue": null,
"LabelMessages": null,
"ExternalPackageId": null
}
],
"Weight": null
},
"RateOptions": {
"CarrierIds": [
"se-2264604"
],
"PackageTypes": [
"package"
],
"ServiceCodes": [
"ups_worldwide_saver"
],
"CalculateTaxAmount": false,
"PreferredCurrency": "USD"
}
}
But when I want to get a label I got the next result:
{
"request_id": "bd64991e-89a5-46a4-b3af-43cf019c4ec0",
"errors": [
{
"error_source": "carrier",
"error_type": "business_rules",
"error_code": "unspecified",
"message": "A shipping carrier error occurred: A package in a Mexico shipment must have a Merchandise Description.",
"carrier_id": "se-2264604",
"carrier_code": "ups",
"carrier_name": "UPS"
}
]
}
I was checking the documentation and I found If want to send a shipping to Mexico I need to set this value on packages field: "content_description"
"packages": [
{
"content_description": "Vitamins",
"package_code": "package",
"weight": {
"value": 0.05,
"unit": "pound"
},
"dimensions": {
"unit": "inch",
"length": 15.0,
"width": 11.0,
"height": 0.25
}
}
]
So my question is: At this moment exists any way to set a value for "content_description"?
Thanks,
Abraham Chaves
Enums on CreateLabelFromRate are not string serializing the enum values and errors result from passing ints.
Hi team,
I am using the SDK when sending an API request and I would like to ask if possible to add the header request id as part of the response so that when we encounter an unexpected error we can easily raise it to your API support team.
Thank you
I am unable to fund carrier accounts as we have in the past. Is this available to the new API?
Thank you!
receiving the following error: request.shipment.customs.customs_items[0].quantity: Input string '5.0' is not a valid integer. Path 'shipment.customs.customs_items[0].quantity', line 1, position 717. The API has this field defined as an Integer while the SDK has it defined as a double.
ShipEngineSDK.CreateLabelFromShipmentDetails.Params.Shipment.Customs.Customs_Items[].Quantity
Tried creating a shipping label on the server, it throw this exception:
fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
An unhandled exception has occurred while executing the request.
Newtonsoft.Json.JsonSerializationException: Error converting value "invalid_date" to type 'ShipEngineSDK.ErrorCode'. Path 'errors[0].error_code', line 7, position 34.
---> System.ArgumentException: Requested value 'invalid_date' was not found.
at Newtonsoft.Json.Utilities.EnumUtils.ParseEnum(Type enumType, NamingStrategy namingStrategy, String value, Boolean disallowNumber)
at Newtonsoft.Json.Converters.StringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
--- End of inner exception stack trace ---
going through the SDK code and trying again i realized that the real error is the following
{
"request_id": "35cf27e6-872b-4fc2-8e8a-24c556b3650d",
"errors": [
{
"error_source": "shipengine",
"error_type": "validation",
"error_code": "invalid_date",
"message": "ship_date must equal today’s date or a future date",
"field_name": "ship_date",
"field_value": "2023-01-06T00:00:00Z"
}
]
}
So it looks like ShipEngineSDK.ErrorCode
is missing some entries like invalid_date
We are trying to test and implement ShipEngine SDK. We already configured and connected our carriers. We are having problem with some of our Carriers. For example we have Australia Post, Aramex, Star Track, Fedex, DHL, Direct Freight, and TNT however we are only getting a response for a rate return for Aramex and Direct Freight.
"errors": [
{
"error_source": "carrier",
"error_type": "business_rules",
"error_code": "unspecified",
"message": "A shipping carrier error occurred: You do not have permissions to create reseller consignments (Generic, Carrier Error Code: GEN_ERROR). length must be between 0 and 200 (Validation, Carrier Error Code: VAL_DIMENSION_MAX). width must be between 0 and 200 (Validation, Carrier Error Code: VAL_DIMENSION_MAX). height must be between 0 and 200 (Validation, Carrier Error Code: VAL_DIMENSION_MAX). (520, dc94a6f6-3c6b-4db7-91f6-6353fa26e076)",
"carrier_id": "unknown",
"carrier_code": "unknown",
"carrier_name": "unknown"
},
{
"error_source": "carrier",
"error_type": "business_rules",
"error_code": "unspecified",
"message": "A shipping carrier error occurred: There are no valid services available.",
"carrier_id": "se-5497981",
"carrier_code": "fedex",
"carrier_name": "FedEx"
},
{
"error_source": "carrier",
"error_type": "business_rules",
"error_code": "unspecified",
"message": "A shipping carrier error occurred: There are no valid services available.",
"carrier_id": "se-5497981",
"carrier_code": "fedex",
"carrier_name": "FedEx"
},
{
"error_source": "carrier",
"error_type": "business_rules",
"error_code": "unspecified",
"message": "A shipping carrier error occurred: None of the products in your contract are available for the submitted request.",
"carrier_id": "unknown",
"carrier_code": "unknown",
"carrier_name": "unknown"
},
{
"error_source": "carrier",
"error_type": "business_rules",
"error_code": "unspecified",
"message": "A shipping carrier error occurred: No rates are available",
"carrier_id": "unknown",
"carrier_code": "unknown",
"carrier_name": "unknown"
}
]
},```
As you can see that some of the carrier_id is marked unknown which makes difficult for us to determine the exact carriers that are having the issues. It is returning the same response as the REST API End-Point.
With other providers we use EEL or PFC codes for customs.
We do not see this field on your c# library.
EEL or PFC:When shipping outside the US, you need to provide either an Exemption and Exclusion Legend (EEL) code or a Proof of Filing Citation (PFC). Which you need is based on the value of the goods being shipped.
If the value of the goods is less than $2,500, then you pass the following EEL code: "NOEEI 30.37(a)"
If the value of the goods is greater than $2,500, you need to get an Automated Export System (AES) Internal Transaction Number (ITN) for your shipment. ITN will look like “AES X20120502123456”. To get an ITN, go to the AESDirect website.
An ITN is required for any international shipment valued over $2,500 and/or requires an export license unless exemptions apply.
from https://omnibasis.freshdesk.com/support/solutions/articles/36000206009-package-customs-information
The two classes are identical. I use these to pass customs information when checking rates and creating labels. Can these be consolidated into one class? Preferably ShipEngineSDK.Common.CustomsItem
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.