cxRest

cxRest

Communicate back into ConnexCS through the API

Example

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

async function main(data) {
  var result = await rest.read(data.routing.dest_number);
  // Do something with result
  return data
}

Methods

(static) create(area, key, data) → {Promise}

Source:

Create Record

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

Datastore Name

key string | number

Row Id

data object

Data Object / Row

Returns:
Type
Promise

(static) delete(area, key) → {Promise}

Source:

Delete Record

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

Datastore Name

key string | number

Row Id

Returns:
Type
Promise

(static) read(read, key) → {Promise.<object>}

Source:

Create Record

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

Datastore Name

key string | number

Row Id

Returns:
Type
Promise.<object>

(static) update(area, key, data) → {Promise}

Source:

Update Record

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

Datastore Name

key string | number

Row Id

data object

Data Object / Row

Returns:
Type
Promise