A minimalistic Elixir library for the Amazon Product Advertising Api version 5.
This package can be installed by adding paapi5
to your list of dependencies in mix.exs
:
def deps do
[
{:paapi5, "~> 1.0.0"}
]
end
Build a signed request for the Amazon Product Advertising API 5 (PAAPI5):
request =
Paapi5.request(
"<access_key>",
"<secret_key>",
"<partner_tag>",
:us,
"SearchItems",
%{"Keywords" => "elixir in action"}
)
You can then use a HTTP client of your choice to actually send this request, e.g.:
items = HTTPoison.request!(request.method, request.url, request.body, request.headers)
The marketplace can either be an atom (e.g., :us
, :it
, :uk
, etc.) or a Paapi5.Marketplace
struct
with the host and region (e.g., %Paapi5.Marketplace{host: "webservices.amazon.it", region: "eu-west-1"}
).
The known marketplaces are :au
, :br
, :ca
, :fr
, :de
, :in
, :it
, :jp
, :mx
, :nl
, :sg
, :sa
, :es
, :se
, :tr
, :ae
, :uk
, :us
.
For a reference about operations and their parameters, see the PAAPI5 documentation.
For working examples on usage of this library, see the tests.
Issues and contributions are very welcome!
To launch tests, run:
mix test
Tests require a valid set of credentials for the Italian PAAPI to be passed via environment variables:
export ACCESS_KEY="your-paapi-access-key"
export SECRET_KEY="your-paapi-secret-key"
export PARTNER_TAG="your-paapi-partner-tag"