Having a frustrating issue with S3 API. Pretty much all functional calls I tried so far always return json response, which get happily translated into elixir maps and lists by Jason (thanks to
config :ex_aws, json_codec: Jason
option).
But one particular API, get_bucket_lifecycle()
, returns XML. Jason then messes up the data because it thinks it’s json.
I tried adding
request = request |> struct(%{headers: Map.merge(request.headers, %{“Accept” => “application/json”})})
to force json but it had no effect.
I also tried aws s3api get-bucket-lifecycle-configuration --bucket cogynt-data --debug
to see what amazon’s own tool is doing, and I’m seeing in debug output that the raw response from server is actually XML, and then they use Python’s boto to read XML into structs which then get output as json to the client.
I know there must be a reason ex_aws has a dependency on :sweet_xml
library, but I’m also concerned that it’s using the outdated API, get_bucket_lifecycle
instead of get-bucket-lifecycle-configuration
and than I’m seemingly unable to get an elixir map/list on the output.
Any tips are much appreciated.