Contentful SDK v0.3.2 Contentful View Source
The Contentful SDK provides helper functions and structs for a subset of the the available Contentful APIs and serves as a container for the shared structs.
The available Contentful APIs are:
Contentful.Delivery
- wraps the Content Delivery API (CDA) - for accessing production ready contentContentful.Preview
- wraps the Content Preview API (CPA) - for accessing drafts prepublicationContentful.Management
- wraps the Content Management API (CMA) - for managing your content
Setup
In order to add the Contentful SDK add the following to your mix.exs
:
# mix.exs
def deps do
[
# your other dependencies, then add:
{:contentful, "~> 0.3"}
]
end
You can configure your access token(s) and Contentful environments via your local config.exs:
# in config.exs
config :contentful, json_library: Poison # optional, as Jason is the default
# per API definition:
config :contentful, delivery: [
space_id: "<my_space_id>",
access_token: "<my_cda_token>",
environment: "<my_environment>" # defaults to `master`
]
config :contentful, management: [
coming: :soon
]
config :contentful, preview: [
coming: :soon
]
Please note that the default json_library
that this SDK is tested with is Jason
, yet Poison
should be compatible.