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:

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.

Link to this section Summary

Functions

The JSON library to use. Can be either configured to Jason or Poison.

Link to this section Functions

Specs

json_library() :: module()

The JSON library to use. Can be either configured to Jason or Poison.

Examples

# in config/config.exs
config :contentful, json_library: Jason

iex> Contentful.json_library()
Jason