我正在尝试根据此处的ebay documantion发送具有枚举的数据类型的json:
http://developer.ebay.com/devzone/rest/api-ref/inventory/types/OperatingHours.html
有问题的字段是dayOfWeekEnum,我尝试通过几种方式用JSON发送:
{"dayOfWeekEnum": "FRIDAY"}
{"dayOfWeekEnum": 0}
{"dayOfWeekEnum": {"dayOfWeekEnum": "FRIDAY"}}
而且它们都没有起作用。我总是收到消息说它无法序列化
dayOfWeekEnum
字段:[{"errorId"=>2004, "domain"=>"ACCESS", "category"=>"REQUEST", "message"=>"Invalid request", "longMessage"=>"The request has errors. For help, see the documentation for this API.", "parameters"=>[{"name"=>"reason", "value"=>"Could not serialize field [operatingHours.dayOfWeekEnum]"}]}]
我假设ebay运行Java api,那么如何正确发送JSON枚举信息?
最佳答案
我从经验中知道,关于字段名称,eBay的文档可能是错误的。您是否尝试过传递dayOfWeek而不是dayOfWeekEnum?