Object Definition

Introduction

You can extend the API by creating new custom objects and extending the standard objects with custom properties, You can do this via the API if you have the Administrator or Developer roles, or via the admin UI. For details on how to create and extend objects using the admin UI, see Data Model Setup.

At every level, custom objects and properties are prefixed with c_ to differentiate them from standard properties that may be placed alongside in a document. For example, retrieving a custom property from a custom object might look like GET /c_records/551ebec0f6b25fd828742de1/c_info

Although a standard object's standard properties cannot be modified, custom properties can be added to extensible standard object classes.

Also some of the standard object’s properties can either be overridden or extended, including the createAcl, defaultAcl and shareAcl.

Object Definition

_id ObjectId

The object definition identifier.

label
String

The object label.

name
String

The object name.

pluralName
String

Based on the name, this is the name used in API routes. For example, to retrieve a list of c_thing objects, use GET /c_things

description
String

The object description.

defaultAcl
Document

All contexts objects of this type will have this ACL merged with their instance ACL.

createAcl
Document

These ACL targets are able to create context objects of this type.

shareAcl
Document

These ACL targets are able to share context objects of this type. The entries defined which access levels and roles can be assigned by which targets.

shareChain
Number

A caller can create a connection granting any level of access in the share chain, as long as it is less than his own.

allowTransfers
Boolean

Allow ownership transfer for this context's objects.

allowConnections
Boolean

Set to enable/disable sharing of contexts for this object.

connectionOptions
Document

Options around connection requests, such as whether to auto-accept and send-notification.

properties
Document Array

All of the properties defined in this object class.

object
String

The context’s object name.

objectTypes
Array

The object's types. For more info, see Object Types.

hasETag
Boolean

If true, an ETag property is made available and is (re)generated on an instance whenever it is updated.

Example Object Definition

{
  "_id": "576870f71d0c03a53cd665cd",
  "access": 7,
  "allowConnections": true,
  "allowTransfers": true,
  "connectionOptions": {
    "requireAccept": true,
    "requiredAccess": 5,
    "sendNotifications": true
  },
  "createAcl": [
    {
      "_id": "576870f71d0c03a53cd665ce",
      "allow": 1,
      "target": "000000000000000000000003",
      "type": 1
    }
  ],
  "created": "2016-06-20T22:40:55.523Z",
  "creator": {
    "_id": "575f58281d0c03a53ccc3ac6",
    "object": "account",
    "path": "/accounts/575f58281d0c03a53ccc3ac6"
  },
  "defaultAcl": [
    {
      "_id": "57b1ebac14e8971b6add7c66",
      "allow": 7,
      "type": 4
    },
    {
      "_id": "57b1ebac14e8971b6add7c67",
      "allow": 4,
      "target": "578483dc46b010416571393d",
      "type": 3
    }
  ],
  "label": "Prescription",
  "lookup": "576870f71d0c03a53cd665cd",
  "name": "c_prescription",
  "object": "object",
  "objectTypes": [],
  "pluralName": "c_prescriptions",
  "properties": [
    {
      "_id": "576d71d01d0c03a53cde6e88",
      "acl": [],
      "auditable": false,
      "autoCreate": false,
      "cascadeDelete": false,
      "creatable": false,
      "expandable": true,
      "grant": 2,
      "indexed": true,
      "label": "Patient",
      "name": "c_patient",
      "optional": false,
      "pacl": [],
      "paths": [],
      "readAccess": 4,
      "readable": true,
      "referenceAccess": 0,
      "removable": false,
      "sourceObject": "account",
      "type": "Reference",
      "unique": false,
      "validators": [],
      "writable": true,
      "writeAccess": 6
    },
    {
      "_id": "576d72a41d0c03a53cde7144",
      "acl": [],
      "array": false,
      "auditable": false,
      "canPull": true,
      "canPush": true,
      "creatable": false,
      "indexed": true,
      "label": "Rx",
      "lowercase": false,
      "maxItems": 100,
      "maxShift": false,
      "minItems": 0,
      "name": "c_rx",
      "optional": false,
      "readAccess": 4,
      "readable": true,
      "removable": false,
      "trim": false,
      "type": "String",
      "unique": false,
      "uniqueValues": false,
      "uppercase": false,
      "validators": [
        {
          "_id": "57914b65356ff1a73d2db0cf",
          "definition": {
            "max": 10000000000,
            "min": 0
          },
          "name": "printableString"
        },
        {
          "_id": "57914b65356ff1a73d2db0d0",
          "name": "required"
        }
      ],
      "writable": true,
      "writeAccess": 6,
      "writeOnCreate": true
    }
  ],
  "shareChain": [
    5,
    4,
    2
  ],
  "updated": "2017-05-26T04:08:39.488Z",
  "updater": {
    "_id": "5771495a1d0c03a53ce83f1a",
    "object": "account",
    "path": "/accounts/5771495a1d0c03a53ce83f1a"
  }
}