# ExCwmanage 
[![Build Docs](](
[![Build Status](](
[![Coverage Status](](

## Required Configuration
The following configuration information is required to connect to the ConnectWise API.  This can be supplied through creating a `dev.secret.exs` and `prod.secret.exs` file or by setting environment variables (preferred for production).

### Obtaining required configuration
1. API root: This will be one of the following *site* urls with additional version information to create the api url.  This is subject to change.
 - Example API root url ``.  As of 2019 the "release" tracks your connectwise version.  Please see the following documentation
2. Company Id: When you log into connectwise this is your *Company Name*
3. Public and Private Key:  (Follow this guide
4. Create a "client id": 

### Using secret files
`dev.secret.exs` and `prod.secret.exs` are in the `config` folder and are called based on the environment you are in.  Below is an example file
use Mix.Config

config :ex_cwmanage,
  cw_api_root: "",
  cw_companyid: "MYCOMPANYID",
  cw_publickey: "MYPUBLICKEY",
  cw_privatekey: "MYPRIVATEKEY"
  cw_clientid: "MYCLIENTID"
### Using environment variables
The following environment variables need to be set if you are not using a *secret* file. This is the recommended method for production.

## Usage
### API Requests
The api follows the standard HTTP REST conventions outlined in the ConnectWise API
HTTP Methods

        Create entity or any non CRUD action
        Return entity or list of entities
        Replace all fields on entity with supplied fields
        Update specific fields on an entity
        Remove entity
### Options
Different resources in the api allow addition options to be passed along using normal url "query" formatting.  Full details are available here

#### Examples
  `ExCwmanage.Api.get("/finances/invoices/count", [conditions: "id=1234"])`
  `ExCwmanage.Api.get("/finances/invoices", [conditions: "id=1234", orderBy: "id"])`

  `ExCwmanage.Api.get_page("/finances/invoices", [pagesize: 100, pageid: 123])`

### The ConnecWise API

### Changes
- version 0.3.0 - removed version tag in accept header that bumps us up to the latest version of the API. 
The api *should* be backwards compatible but this is considered a breaking change.

## Installation

If [available in Hex](, the package can be installed
by adding `ex_cwmanage` to your list of dependencies in `mix.exs`:

def deps do
    {:ex_cwmanage, "~> 0.3.0"}

Documentation can be generated with [ExDoc](
and published on [HexDocs]( Once published, the docs can
be found at [](