Attach a body to the API calls

For those API calls that require a body, the RAML description of each API call dictates the precise format of its body object. The App is responsible for building this body object accordingly, and then passing it to cui.js inside the options parameter.

The options.data property

Cui.js looks for the body object in the value of the options.data property, and will stringify the object prior to attaching it to the API call. Here is a basic example that sends organization data to the updateOrganization() call.

myCuiJs.updateOrganization({
    organizationId: 'YOUR-ORG-ID',
    data: {
        id: 'YOUR-ORG-ID',
        version: 1445351932000,
        creation: 1445351932000,
        realm: 'YOUR-REALM',
        status: 'active',
        .
        .
        .
    }
 }).then(function(response) {
    // ...do something with response
    var updatedOrgData = response;
 }).fail(function(err) {
    // ...handle error
    var errStr = myCuiJs.parseError(err);
 });