Introduction

Every dataset on DokuMe is an object which is build out of an object id and an instance id. With the object id you can generally work with all datasets of the same type while when also passing the instance id you will get one specific instance of an object.

Get Object

getObject() is a function for accessing raw data of a user or client. To specify what data you want to retrieve you can pass 4 parameters.

backend.getObject(objectId, instanceId, options, callback, header)

Get Function

getFunction() is a special form of getObject. Instead of getting the raw data object the data is manipulated on server side before it is sended back to you.

backend.getFunction(fnName, options, callback, header)
attribute description default
include_data if set to false you will just get Object IDs of avalable Data true
references get data from other tables who are connected null
where filter data null
shared Returns data not only from actual user but also from all users the actual user has an accessright for. By adding GROUPED to the option the backend will return the shared data grouped by user ids. null
limit filter data null
fields select fields, aggregate fields & count datasets null

references

A reference gives you the opportunity to get also child objects of the parent object in one request.

const options = {
    references: [{
        OBJECT: objectName,
        IGNORE_WHERE: false,
        REFERENCES: [{
            OBJECT: objectName_child,
            REFERENCES: [...]
        }]
    }]
}

If IGNORE_WHERE is true the where statement will only filter inside of the reference and will not filter on the parent element.

custom references

Sometimes you don't have a direct reference to an object but you need data from a different object. Than you can use custom references to get the needed data.

attribute description default
objectId ID of the object you want to add to the request must be filled
cardinalityOption 1: get only one entry / 2: get multiple entries must be filled
referenceField fieldname of parent object to compare with field in custom object only if cardinalityOption == 2
yourAttributeName name for the array where the entries should be placed must be filled
objectFieldName fieldname of the table you want to add to the request which should be used for finding the right values must be filled
where where filter for the table you are trying to connect optional
const options = {
    references: [{
        OBJECT: 'CUSTOM',
        OBJECT_ID: objectId,
        CARDINALITY: cardinalityOption,
        REFERENCE_FIELD: referenceField,
        REFERENCE_TAG: yourAttributeName,
        FIELD_NAME: objectFieldName,
        WHERE: [...]
    }]
}

where

This option gives you the possibility to filter your data. Therefore please passe an array with your filter rule set.

const options = {
    where: [{
        key: 'columnName',
        operator: is, //isnot, higher, lower, lower-equal, higher-equal, in, notin
        value: value || [value, value],
        ignore: false
    }]
}

If ignore is true you will get an object with all child objects where at least one condition meets the where statement.

shared

The shared option will give you data from third profiles you have access to.

const options = {
    shared: true
}

const options = {
    shared: {
        grouped: true
    }
}

const options = {
    shared: {
        type: 'combine'
    }
}

limit

The limit option gives 2 opportunities. One is to limit the amount of data and in the order key you can specify how the data should be sort. You can also sort without the limit and startIdx field.

const options = {
    limit: [{
        limit: 5,
        startIdx: 0,
        order: {
          direction: 'desc',
          by: 'ID'
        }
    }]
}

select fields

If you don't need to get all data from one table you can select specific fields with this parameters.

backend.getObject(22, instanceId, {
    fields: {
        type: 'select',
        fields: ['NAME', 'EXTENSION', 'PATH']
    }
}, console.log)

distinct fields

The distinct type allows to aggregate data. You can specify the aggregation mode by passing the fields.

backend.getObject(22, instanceId, {
    fields: {
        type: 'distinct',
        fields: ['PATH', 'EXTENSION']
    }
}, console.log)

count fields

The count type will count the amount of data records.

backend.getObject(22, null, {
fields: {
        type: 'count',
        fields: ['EXTENSION'],
        userSpecific: false
    }
}, console.log)

count metadata

If count true given you will receive a metadata object with the amount of data records.

backend.getObject(22, null, {
count: true
}, console.log)

Save and update object

backend.saveObject(objectId, instanceId, params, callback, header)
attribute value description
ID 'create' this will insert new reference object
ID 890 this will update a reference object with id 890
ID_RESPONSE your guuid in request answer you will get an information if the referenced object was successfully saved or updated. the object name is the guuid you set so you can find the right answer when saving multiple references.

Example Insert (same with update but instead of 'create' use the instance id of object)

backend.saveObject(219, 38, {
    FORM_ID: 8,
    EMAIL: "",
    FORMS_FIELD_VALUE: {
        ID: 'create',
        ID_RESPONSE: "my_guuid_name_to_find_reference",
        FORM_ID: 8,
        FIELD_ID: "174",
        VALUE: "2020-01-31",
        CONNECTED_ID: 1
    },
    ACTIVE: 0
});

Answer

{
    SUCCESS: true,
    MESSAGE: 1,
    CREATE: {
        "my_guuid_name_to_find_reference": {
            SUCCESS: true,
            MESSAGE: "170"
        }
    }
}

Save function

backend.saveFunction(fnName, params, callback, headerOff)

Delete object

This function will delete an instance of an object.

backend.getObject(objectId, instanceId, callback)

Delete function

This function will delete an instance of an object.

backend.deleteFunction(fnName, instanceId, callback, headerOff)

Replace Function

replaceObject() is a special form of saveObject. It will check if a dataset is already created and update it. Otherwise the function will insert new data.

backend.replaceObject(objectId, params, keyfields, callback);
attribute description type
objectId ID of object definition ID
params dataset which should be inserted of updated. Can also be an array of more than one dataset. object or array
keyfields These fields are checked in the database (unique combination, as seen in the primary key) - if exactly one hit is found, the remaining other fields are updated. If no match is found, the object will be inserted as new dataset. If more than one object is found, an error is returned. Example: ["TIMING_POINT","LAP", "STREAMING_USER_ID"] array

Patch function

patch() is a special form of saveObject. You can save, update and delete multiple objects at the same time.

backend.patch(objectId, json, callback, type, headerOff)

Example call for creating events

backend.patch('159',[{
    BACKEND_ACTION: 'delete',
    ID: 343 // instanceId required
    ID_RESPONSE: 'multi3',
}, {
    BACKEND_ACTION: 'create',
    ID_RESPONSE: 'multi1',
    TITLE: 'multiTest'
}, {
    BACKEND_ACTION: 'update',
    ID: 342, // instanceId required
    ID_RESPONSE: 'multi2',
    TITLE: 'multiTest2'
}], callback, 'object');
attribute description type
objectId ID of object definition ID
params dataset which should be inserted of updated. Can also be an array of more than one dataset. See example call for all three types: create, update, delete object or array

Multi Request

multi() is a special function to execute multiple get requests at the same time.

Example call for executing multiple requests:

backend.multi(requests, callback);

Example requests object for notebook object 159

{
    "note0": {
        "objectId": 159,
        "shared": true,
    },
    "note1": {
        "objectId": 159,
        "shared": true,
    },
    "note2": {
        "objectId": 159,
        "shared": true,
        "include_data": true,
        "references": [{
            "OBJECT": "USERINTERFACE"
        }],
    },
    "note3": {
        "objectId": 159,
        "shared": true,
        "include_data": true,

        "where": [{
            "key": "STATUS",
            "operator": "is",
            "value": "3"
        }]
    }
}
attribute description type
requests You can define for each request an own name. In the above example it is calles note0, note1 etc. Each request object needs to have an attribute objectId where you define the object you want to retrieve. The rest is the same structure like all other requests to the DokuMe backend Object

getObjectAttachements

Get all objects which are attached to the object. You can get all or only one specific instance

backend.getObjectAttachements(objectId, instanceId, options, callback)

Create object attachements

Attach one object to another even if there is no direct connection or reference to each other

backend.createAttachement(objectId, instanceId, attachedObject, attachedID, callback)

Profile header

By passing an profileId to the backend function you can make the call from a different account than yours.

backend.getObject(objectId, instanceId, params, callback, {
    PROFILEID: 12345
})