cxRest

cxRest

Communicate back into ConnexCS through the API

Example

const cxRest = require('cxRest');
const api = cxRest.auth("api@yourdomain.com"); 

async function main(data) {
  var customers = await api.get('customer');
  // Do something with result
  return customers
}

Methods

(static) delete(path) → {Promise}

Description:
  • Delete Record

Example
await rest.delete('customer/1234')
Parameters:
Name Type Description
path string

Path

Returns:
Type
Promise

(static) get(path, params, Responsenullable) → {Promise.<object>}

Description:
  • Read Record

Example
var data = await rest.get('customer/1234')
Parameters:
Name Type Attributes Description
path string

Path

params object

Params

Response string <nullable>

Type

Returns:
Type
Promise.<object>

(static) post(path, Data) → {Promise}

Description:
  • Create Record

Example
await rest.post('customer', {name: 'Joe Blogs'}})
Parameters:
Name Type Description
path string

Path

Data object

Data

Returns:
Type
Promise

(static) put(path, data) → {Promise}

Description:
  • Update Record

Example
await rest.put('customer/1234', {name: 'Alice'})
Parameters:
Name Type Description
path string

Path

data object

Data

Returns:
Type
Promise