Search code examples
javajakarta-eeenumsebay-api

Sending JSON with enum data types


I am trying to send a json with a data type that is a enum according to the ebay documantion here:

http://developer.ebay.com/devzone/rest/api-ref/inventory/types/OperatingHours.html

The field in question is the dayOfWeekEnum, which I tried sending in my JSON several ways:

{"dayOfWeekEnum": "FRIDAY"}
{"dayOfWeekEnum": 0}
{"dayOfWeekEnum": {"dayOfWeekEnum": "FRIDAY"}}

And none of them didn't work. I alwyas get the message saying it could not serialize the field 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]"}]}] 

I am assuming ebay runs a Java api, so how should I send my JSON enum info properly?


Solution

  • I know from experience that eBay's documentation can be wrong when it comes to the names of fields. Have you tried passing dayOfWeek instead of dayOfWeekEnum?