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.

{
  "_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"
  }
}

List

GET https://api.dev.medable.com/your_org_name/v2/objects

Path Parameters

Name
Type
Description

your_org_name

string

{
  "data": [
    {
      "_id": "594da5c0cfc40501006d2d33",
      "access": 7,
      "allowConnections": true,
      "allowTransfers": true,
      "connectionOptions": {
        "requireAccept": true,
        "requiredAccess": 5,
        "sendNotifications": true
      },
      "createAcl": [
        {
          "_id": "594da5c011f67101005a2b12",
          "allow": 1,
          "target": "000000000000000000000003",
          "type": 1
        }
      ],
      "created": "2017-06-23T23:35:28.787Z",
      "creator": {
        "_id": "5771495a1d0c03a53ce83f1a",
        "object": "account",
        "path": "/accounts/5771495a1d0c03a53ce83f1a"
      },
      "defaultAcl": [
        {
          "_id": "594da5c011f67101005a2b11",
          "allow": 1,
          "target": "000000000000000000000003",
          "type": 1
        }
      ],
      "favorite": false,
      "feedDefinition": [],
      "label": "exam",
      "lookup": "594da5c0cfc40501006d2d33",
      "name": "c_exam",
      "object": "object",
      "objectTypes": [],
      "pluralName": "c_exams",
      "properties": [],
      "shareChain": []
    }
  ],
  "hasMore": false,
  "object": "list"
}
$.ajax({
    url: "https://api.dev.medable.com/example/v2/objects",
    method: "GET",
    dataType : "json",
    xhrFields: {
        withCredentials: true
    },
    headers: {
        "Medable-Client-Key": "GsAqlhnIMzrDeD8V2MBQWq"
    }
}
}).done(function(data) {
    // ...
});

Read

GET https://api.dev.medable.com/your_org_name/v2/objects/object_id

Path Parameters

Name
Type
Description

your_org_name

string

object_id

string

{
  "_id": "594da5c0cfc40501006d2d33",
  "access": 7,
  "allowConnections": true,
  "allowTransfers": true,
  "connectionOptions": {
    "requireAccept": true,
    "requiredAccess": 5,
    "sendNotifications": true
  },
  "createAcl": [
    {
      "_id": "594da5c011f67101005a2b12",
      "allow": 1,
      "target": "000000000000000000000003",
      "type": 1
    }
  ],
  "created": "2017-06-23T23:35:28.787Z",
  "creator": {
    "_id": "5771495a1d0c03a53ce83f1a",
    "object": "account",
    "path": "/accounts/5771495a1d0c03a53ce83f1a"
  },
  "defaultAcl": [
    {
      "_id": "594da5c011f67101005a2b11",
      "allow": 1,
      "target": "000000000000000000000003",
      "type": 1
    }
  ],
  "favorite": false,
  "feedDefinition": [],
  "label": "exam",
  "lookup": "594da5c0cfc40501006d2d33",
  "name": "c_exam",
  "object": "object",
  "objectTypes": [],
  "pluralName": "c_exams",
  "properties": [],
  "shareChain": []
}
$.ajax({
    url: "https://api.dev.medable.com/example/v2/objects/594da5c0cfc40501006d2d33",
    method: "GET",
    dataType : "json",
    xhrFields: {
        withCredentials: true
    },
    headers: {
        "Medable-Client-Key": "GsAqlhnIMzrDeD8V2MBQWq"
    }
}
}).done(function(data) {
    // ...
});

Create

POST https://api.dev.medable.com/your_org_name/v2/objects

Path Parameters

Name
Type
Description

your_org_name

string

Request Body

Name
Type
Description

label

string

name

string

description

string

defaultAcl

string

json

createAcl

string

json

shareChain

array

array of integers

allowConnections

boolean

connectionOptions

string

json

properties

array

array of objects

objectTypes

array

array of objects

{
    "_id": "594da5c0cfc40501006d2d33",
    "access": 7,
    "allowConnections": true,
    "allowTransfers": true,
    "connectionOptions": {
        "requireAccept": true,
        "requiredAccess": 5,
        "sendNotifications": true
    },
    "createAcl": [
        {
            "_id": "594da5c011f67101005a2b12",
            "allow": 1,
            "target": "000000000000000000000003",
            "type": 1
        }
    ],
    "created": "2017-06-23T23:35:28.787Z",
    "creator": {
        "_id": "5771495a1d0c03a53ce83f1a",
        "object": "account",
        "path": "/accounts/5771495a1d0c03a53ce83f1a"
    },
    "defaultAcl": [
        {
            "_id": "594da5c011f67101005a2b11",
            "allow": 1,
            "target": "000000000000000000000003",
            "type": 1
        }
    ],
    "favorite": false,
    "feedDefinition": [],
    "label": "exam",
    "lookup": "594da5c0cfc40501006d2d33",
    "name": "c_exam",
    "object": "object",
    "objectTypes": [],
    "pluralName": "c_exams",
    "properties": [],
    "shareChain": []
}
$.ajax({
    url: "https://api.dev.medable.com/example/v2/objects",
    method: "POST",
    dataType : "json",
    xhrFields: {
        withCredentials: true
    },
    headers: {
        "Medable-Client-Key": "GsAqlhnIMzrDeD8V2MBQWq"
    },
    data: {
    "label": "pulse",
    "name" : "pulse",
    "defaultAcl": [
        {
            "target": "000000000000000000000003",
            "type": 1
        }
    ],
    "createAcl": [
        {
            "target": "000000000000000000000003",
            "type": 1
        }
    ]
}
}).done(function(data) {
    // ...
});

Update

PUT https://api.dev.medable.com/your_org_name/v2/objects/object_id

Path Parameters

Name
Type
Description

your_org_name

string

object_id

string

Request Body

Name
Type
Description

label

string

name

string

description

string

defaultAcl

string

json

createAcl

string

json

shareChain

array

array of integers

allowConnections

boolean

connectionOptions

string

json

properties

array

array of objects

objectTypes

array

array of objects

{
    "_id": "594da5c0cfc40501006d2d33",
    "access": 7,
    "allowConnections": false,
    "allowTransfers": true,
    "connectionOptions": {
        "requireAccept": true,
        "requiredAccess": 5,
        "sendNotifications": true
    },
    "createAcl": [
        {
            "_id": "594da5c011f67101005a2b12",
            "allow": 1,
            "target": "000000000000000000000003",
            "type": 1
        }
    ],
    "created": "2017-06-23T23:35:28.787Z",
    "creator": {
        "_id": "5771495a1d0c03a53ce83f1a",
        "object": "account",
        "path": "/accounts/5771495a1d0c03a53ce83f1a"
    },
    "defaultAcl": [
        {
            "_id": "594da5c011f67101005a2b11",
            "allow": 1,
            "target": "000000000000000000000003",
            "type": 1
        }
    ],
    "favorite": false,
    "feedDefinition": [],
    "label": "exam",
    "lookup": "594da5c0cfc40501006d2d33",
    "name": "c_exam",
    "object": "object",
    "objectTypes": [],
    "pluralName": "c_exams",
    "properties": [],
    "shareChain": [],
    "updated": "2017-06-23T23:58:36.944Z",
    "updater": {
        "_id": "5771495a1d0c03a53ce83f1a",
        "object": "account",
        "path": "/accounts/5771495a1d0c03a53ce83f1a"
    }
}
$.ajax({
    url: "https://api.dev.medable.com/example/v2/objects/594da5c0cfc40501006d2d33",
    method: "PUT",
    dataType : "json",
    xhrFields: {
        withCredentials: true
    },
    headers: {
        "Medable-Client-Key": "GsAqlhnIMzrDeD8V2MBQWq"
    },
    data: {
    "allowConnections": "false"
}
}).done(function(data) {
    // ...
});

Delete

DELETE https://api.dev.medable.com/your_org_name/v2/objects/object_class_id

Path Parameters

Name
Type
Description

your_org_name

string

object_class_id

string

{
    "object": "result",
    "data": true
}
$.ajax({
    url: "https://api.dev.medable.com/example/v2/objects/594da5c0cfc40501006d2d33",
    method: "DELETE",
    dataType : "json",
    xhrFields: {
        withCredentials: true
    },
    headers: {
        "Medable-Client-Key": "GsAqlhnIMzrDeD8V2MBQWq"
    }
}).done(function(data) {
    // ...
});

Last updated