c# - Shippo Tracking FeDex Error in Json Serialization in C#
问题描述
I was trying to use the project ShippingTesting in Visual Studio(C#). I tried UPS
which works great.
But when I tried FeDex
, it threw an error saying:
"Newtonsoft.Json.JsonSerializationException", " Additional information: Error converting value "PRE_TRANSIT" to type 'Shippo.ShippoEnums+TrackingStatus'. Path 'tracking_history[0].status',"
It looks like a JSON serialization issue. Will this be a constant issue with Fedex?
Thanks!
解决方案
在最新版本的 API 中添加了“PRE_TRANSIT”作为可能的状态(当标签已创建但尚未进入传输时,它会替换旧的初始“未知”状态)。
可能需要更新 C# 库以支持此附加映射。作为一种解决方法,您可以在请求的标头中传递较旧的 API 版本(“2018-02-08”之前),这应该返回旧的“未知”映射。
推荐阅读
- php - 你如何从mysql数据库中获取?
- javascript - 如何滚动到“#”之后添加到 url 的标题?
- spring-mvc - 如何在 Spring 控制器方法参数中添加自定义参数(如:@RequestParam、Model)?
- git - 为什么拉取请求会在变基后显示额外的提交?
- java - 可变列表的 java 到 kotlin 语言翻译问题
- http - 为什么使用 HTTP 协议很难实现实时连接?
- grads - 在 Grads 中打开 Shapefile
- javascript - 带有经典模块的 TypeScriptResolution 工作不正确
- python - 将字典中的值转换为矩阵
- javascript - 从 regex () 中获取字符串的行为不符合预期