Automattic / wpcom.ex

WordPress.com Elixir API client
https://hex.pm/packages/wpcom
MIT License
9 stars 2 forks source link

wpcom.ex

Official Elixir library for the WordPress.com REST API.

Setup

def deps do
  [
    {:wpcom, "~> 1.0.0"}
  ]
end

Authentication

Some WordPress.com REST API endpoints are publicly accessible. For instance, retrieving a list of posts from a public site can be done without any credentials.

However, many API operations do require authentication. So if your application needs to access protected endpoints, you'll need to obtain an OAuth2 token. For detailed instructions on acquiring a token, refer to the OAuth2 Authentication guide in the WordPress.com Developer Resources.

Once you've obtained your token, you can configure your application to use it by adding the following line to your runtime.exs file:

config :wpcom, :oauth2_token: "_YOUR_OAUTH2_TOKEN_HERE_"

Testing

mix test

Static Analysis

mix dialyzer
mix credo