LogoLogo
  • Introduction
  • Features
  • Getting Started
    • Cortex User Guide
      • Organizations
      • Log in
      • Generate an API key
      • Make your first API request
      • Configure the org settings
      • Set up a data model
        • Create custom objects
        • Add custom properties
      • One-to-many relationships
      • Read and write data
      • Making a Request
      • Handling responses
      • Authentication
      • Two-factor authentication
      • Set third-party cookies
      • Connections
      • Upload files
      • Cortex iOS
      • Get started with Swift
      • Cortex service accounts
      • Cortex developer tools
      • Automated Account Notifications
  • Cortex API
    • Overview
    • Objects
      • Objects Overview
      • Organization
      • Account
      • Connections
      • Notifications
      • Stats
      • Logs
      • Export
      • Events
      • Room
    • Object Definition
      • Object Properties
        • Any
        • Binary
        • Boolean
        • Date
        • Document
        • File
        • Geometry
        • List
        • Number
        • ObjectId
        • Reference
        • String
    • Object Types
    • Access Control
    • Querying
      • Query Operators
      • Property Selection
      • Property Access
    • Aggregating
      • Aggregation Operators
    • Scripting
      • Script Types
      • Script Limits
      • ObjectId
      • CortexObject
        • Accounts
        • Views
      • Cursors
      • Operations
      • Script Modules
        • API Module
        • Base64 Module
        • Cache Module
        • Connections Module
        • Console Module
        • Consts Module
        • Counters Module
        • Crypto Module
        • HTTP Module
        • Logger Module
        • Notifications Module
        • Request Module
        • Response Module
        • SAML Module
        • Schemas Modules
        • Script Module
        • Session Module
        • Util.id Module
        • Util.ip Module
        • Util.paths Module
        • XML Module
        • Developer
        • Config
        • Renderer
        • SFTP
        • FTP
        • DB
          • Cursors
          • Driver
      • Static Methods
        • Accounts
        • Views
        • Cursors
      • Audit
      • Environments
      • HTTP Driver
      • Notifications
        • Firebase Cloud Messaging (FCM)
        • Tencent Push Notification Service Configuration
      • Televisit
      • Transforms
      • Localization
      • Available Javascript Libraries
    • Decorators
      • Runtime
        • Acl
        • As
        • Log
        • Profile
      • Static
        • Env
        • Job
        • Object
        • On
        • Policy
        • Route
        • Transform
        • Trigger
    • Expressions
      • Primer
      • Pipelines
      • Operators
      • Accumulators
      • Variables
      • Conditionals
      • Transforms
      • Triggers
      • On
      • Events
    • Faults
      • Fault Reference
  • Releases
    • Cortex Release Notes
      • Cortex API 2.28.3 (R3.4.6)
      • Cortex API 2.28.1 (R3.4.3)
      • Cortex API 2.27.2 (R3.4.1)
      • Cortex API 2.27.1 (R3.3.5)
      • SQL DB Connector 1.3.4 (R3.3.3)
      • Cortex API 2.26.2 (R3.3.1)
      • Cortex API 2.26.1 (R3.2.2)
      • Cortex API 2.26.0 (R3.2.1)
      • SQL DB Connector 1.3.3
      • Cortex API 2.25.0 (R3.1.1)
      • SQL DB Connector 1.3.2 (R3.1.0)
      • Cortex API 2.24.2 (R3.0.2)
      • SQL DB Connector 1.3.1 (R3.0.0)
      • Cortex API 2.24.1 (R2.3.3)
      • Cortex API 2.24.0 (R2.3.2)
      • SQL DB Connector 1.3.0 (R2.3.0)
      • Cortex API 2.23.0 (R2.2.4)
      • SQL DB Connector 1.2.0 (R2.2.0)
      • Cortex API 2.22.2 (R2.1.2)
      • Cortex API 2.22.1 and SQL DB Connector 1.1.1 (R2.0.1)
      • Cortex API 2.22.0
      • Cortex API 2.21.3
      • Cortex API 2.21.2
      • Cortex Web 4.16.0
      • Cortex Web 4.15.1
      • Cortex API 2.20.1
      • Cortex Web 4.14.0
      • Cortex Renderer 1.3.3
      • Cortex API 2.19.4
      • Cortex API 2.19.3 and Cortex Web 4.13.1
      • Cortex Renderer 1.3.2
      • Cortex API 2.19.1
      • Cortex API 2.18.0
      • Cortex API 2.17.6
      • Cortex API 2.17.5
      • Cortex API 2.17.4
      • Cortex API 2.17.3
      • Cortex API 2.17.2
      • Cortex API 2.17.1
      • Cortex API 2.16.0
      • Cortex API 2.15.9
      • Cortex API 2.15.8-1
      • Cortex 2.15.8
      • Cortex API 2.18.1
      • Cortex API 2.16.1
      • Cortex Renderer 1.3.1
      • Cortex Renderer 1.3.0
      • Cortex Renderer 1.2.2
      • Cortex Renderer 1.2.1
      • Cortex Renderer 1.2.0
    • Third-Party License Attribution

© 2025 Medable, Inc. All rights reserved.

On this page
  • Object Type Properties
  • Examples

Was this helpful?

  1. Cortex API

Object Types

Sub-classing objects

In your data modeling, you may find that you want to define an object class that inherits all properties from another. For example, you might have a generic c_assessment class with properties like c_patient and more specific classes like c_blood_test that has all the properties of c_assessment but also a set of more specific properties like c_blood_type.

To create an object type, you simply add the object type definitions into the objectTypes array of an object's definition. These types will inherit all the properties from the super-class (or super-type).

The properties that define an object type are as follows:

Object Type Properties

Name

Type

Description

name

String

The API name for the object type

label

String

The human readable label for the object type

properties

Property Definition Array

The array of property definitions for properties specific to this object type

Once an object type is defined, the type property becomes required when creating instances of the object. The type property is populated with the name of the object type you are creating.

Examples

In this example, we've created the object class c_assessment and set the proper ACL's. We've also added a property to this object that all of this object's types will share: c_patient. This is because all assessments will be made on a particular patient, no matter what kind of assessment it is.

GET /objects/5951719d514ef101000216cf
{
    "_id": "5951719d514ef101000216cf",
    "access": 7,
    "allowConnections": true,
    "allowTransfers": true,
    "connectionOptions": {
        "requireAccept": true,
        "requiredAccess": 5,
        "sendNotifications": true
    },
    "createAcl": [
        {
            "_id": "5951719dfc65ed0100e62068",
            "allow": 1,
            "target": "000000000000000000000003",
            "type": 1
        }
    ],
    "created": "2017-06-26T20:42:05.183Z",
    "creator": {
        "_id": "5771495a1d0c03a53ce83f1a",
        "object": "account",
        "path": "/accounts/5771495a1d0c03a53ce83f1a"
    },
    "defaultAcl": [
        {
            "_id": "5951719dfc65ed0100e62069",
            "allow": 7,
            "target": null,
            "type": 4
        }
    ],
    "favorite": false,
    "feedDefinition": [],
    "label": "Assessment",
    "lookup": "5951719d514ef101000216cf",
    "name": "c_assessment",
    "object": "object",
    "objectTypes": [],
    "pluralName": "c_assessments",
    "properties": [
        {
            "_id": "595171e811f6710100683480",
            "acl": [],
            "auditable": false,
            "autoCreate": false,
            "cascadeDelete": true,
            "creatable": false,
            "expandable": true,
            "grant": 0,
            "indexed": true,
            "label": "Patient",
            "name": "c_patient",
            "optional": false,
            "pacl": [],
            "paths": [],
            "readAccess": 4,
            "readable": true,
            "referenceAccess": 5,
            "removable": false,
            "sourceObject": "account",
            "type": "Reference",
            "unique": false,
            "validators": [
                {
                    "_id": "595171e811f6710100683481",
                    "name": "required"
                }
            ],
            "writable": true,
            "writeAccess": 6
        }
    ],
    "shareChain": [
        5,
        4,
        2
    ],
    "updated": "2017-06-26T20:43:21.022Z",
    "updater": {
        "_id": "5771495a1d0c03a53ce83f1a",
        "object": "account",
        "path": "/accounts/5771495a1d0c03a53ce83f1a"
    }
}

You'll notice that the objectTypes value in the JSON result above is an empty array. We're going to add a c_blood_test object type to this array.

POST /objects/5951719d514ef101000216cf/objectTypes
{
    "label":"Blood Test",
    "name":"c_blood_test",
    "properties": [
        {
            "label":"Blood Type",
            "name":"c_blood_type",
            "type": "String",
            "validators": [
                {
                    "name": "required"
                }
            ]
        }
    ]
}

Now, the objectTypes array contains the c_blood_test definition we just created.

GET /objects/5951719d514ef101000216cf/objectTypes
{
    "data": [
        {
            "_id": "5951751611f6710100683fdc",
            "label": "Blood Test",
            "name": "c_blood_test",
            "properties": [
                {
                    "_id": "5951751611f6710100683fdd",
                    "acl": [],
                    "array": false,
                    "auditable": false,
                    "canPull": true,
                    "canPush": true,
                    "creatable": false,
                    "indexed": false,
                    "label": "Blood Type",
                    "lowercase": false,
                    "maxItems": 100,
                    "maxShift": false,
                    "minItems": 0,
                    "name": "c_blood_type",
                    "optional": false,
                    "readAccess": 4,
                    "readable": true,
                    "removable": false,
                    "trim": false,
                    "type": "String",
                    "unique": false,
                    "uniqueValues": false,
                    "uppercase": false,
                    "validators": [
                        {
                            "_id": "5951751611f6710100683fde",
                            "name": "required"
                        }
                    ],
                    "writable": true,
                    "writeAccess": 6,
                    "writeOnCreate": true
                }
            ]
        }
    ],
    "hasMore": false,
    "object": "list"
}

We can now create a c_assessment object instance of type c_blood_test:

POST /c_assessments
{
    "c_patient":"5771495a1d0c03a53ce83f1a",
    "type":"c_blood_test",
    "c_blood_type":"Type A"
}

The resulting instance of c_assessment is of type: c_blood_test and contains both the base property of c_patient and the c_blood_test type property c_blood_type.Request

{
    "_id": "59517718cfc40501006da501",
    "access": 7,
    "c_blood_type": "Type A",
    "c_patient": {
        "_id": "5771495a1d0c03a53ce83f1a",
        "object": "account",
        "path": "/accounts/5771495a1d0c03a53ce83f1a"
    },
    "created": "2017-06-26T21:05:28.068Z",
    "creator": {
        "_id": "5771495a1d0c03a53ce83f1a",
        "object": "account",
        "path": "/accounts/5771495a1d0c03a53ce83f1a"
    },
    "favorite": false,
    "object": "c_assessment",
    "owner": {
        "_id": "5771495a1d0c03a53ce83f1a",
        "object": "account",
        "path": "/accounts/5771495a1d0c03a53ce83f1a"
    },
    "shared": false,
    "type": "c_blood_test"
}

Last updated 3 years ago

Was this helpful?