Elixir SDK for the Contentful Content APIs.
Contentful provides a content infrastructure for digital teams to power content in websites, apps, and devices. Unlike a CMS, Contentful was built to integrate with the modern software stack. It offers a central hub for structured content, powerful management and delivery APIs, and a customizable web app that enable developers and content creators to ship digital products faster.
The official docs can be found here: https://www.contentful.com/developers/docs/references/content-delivery-api/.
The API provides the content for Contenful apps. It's read only and the recommended way to deliver large amounts of content.
The official docs can be found here: https://www.contentful.com/developers/docs/references/content-management-api/.
The API provides the capability to manage content you have stored with Contentful.
The official docs can be found here: https://www.contentful.com/developers/docs/references/content-preview-api/.
The Preview API can be used to access the latest versions and drafts of your content. It maintains compatibility with the Contentful Delivery API.
- Add contentful to your list of dependencies in
mix.exs
:
def deps do
[{:contentful, "~> 0.3.0"}]
end
- Ensure contentful is started before your application:
def application do
[applications: [:contentful]]
end
For the usage, see the documentation published to hex.
In case you want to compile the docs locally, run:
$ mix docs
# to view, we recommend:
$ cd doc && python -m SimpleHTTPServer # or any other quick way to serve static content locally
then open http://localhost:8000
.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
This library makes use of the Contentful APIs. It helps to have an account and to setup a secrets file for testing:
$ cat config/secrets.dev.exs
config :contentful, delivery: [
access_token: "<my_cda_access_token>",
environment: "master",
space_id: "<my_space_id>"
]
# for testing
$ cat config/secrets.test.exs
config :contentful, delivery: [
access_token: "<my_cda_access_token>",
environment: "testing",
space_id: "<my_space_id>"
]
We freeze requests by using exVCR
, in case you want to rebuild these files, make sure that test assertions match.