Common Models

The following is an example of a Labor Tag which is applicable to Events but not to Locations. (To search for a Location searchable with a Labor Code, you’d create a child of this Code that is applicable.) This Tag’s parent has parentCodeId which, in this example, is a Code called Constituencies.

{
  "codeId": 20515,
  "parentCodeId": 20513,
  "name": "Labor",
  "description": "This is a description of Labor.",
  "codeType": "Tag",
  "dateCreated": "2015-04-05T12:59:00Z",
  "dateModified": "2015-05-05T16:00:00Z",
  "supportedEntities": [
    {
      "name": "Events",
      "isSearchable": true,
      "isApplicable": true
    },
    {
      "name": "Locations",
      "isSearchable": true,
      "isApplicable": false
    }
  ]
}

The following Source Code is used to keep track of people and contributions that came from digital ad campaigns:

{
  "codeId": 20615,
  "parentCodeId": null,
  "name": "Digital ads",
  "description": "Used to mark people and contributions retrieved because of digital ad campaigns",
  "codeType": "SourceCode",
  "dateCreated": "2017-10-05T12:59:00Z",
  "dateModified": "2017-10-08T12:00:00Z",
  "supportedEntities": null
}

The following list of Codes is formatted for batch operations:

{
  "codes": [
    {
      "parentCodeID": "1019966",
      "name": "Labor",
      "description": "The tag for describing Labor",
      "supportedEntities": [
        {
          "name": "Contacts",
          "isSearchable": true,
          "isApplicable": true
        },
        {
          "name": "ActivistCodes",
          "isSearchable": true,
          "isApplicable": true
        }
      ],
      "codeType": "Tag"
    },
    {
      "name": "Volunteers",
      "description": "The tab for describing all of our Volunteers",
      "supportedEntities": null,
      "codeType": "Tag"
    }
  ]
}

Code

Each Code has the following properties:

Property

Type

Description

codeId

int

Read-only; Unique identifier for a Code in this context

parentCodeId

int

Optional; a unique identifier for this Code’s parent

name

string

A name for this Code, no longer than 50 characters and is not guaranteed to be unique. In addition to the standard text input validation rules, names must not include slashes or backslashes. More precisely, it must not match this regular expression: [\/\\]+

description

string

A description for this Code, no longer than 200 characters and may be null.

codeType

string

Determines whether a Code is a Tag or Source Code. Valid values are Tag and SourceCode. Default is SourceCode.

dateCreated

datetime

Read-only; The date and time this Code was created

supportedEntities

array

Optional; An array of zero or more Supported Entity objects that enumerate the searchability and applicability rules of this Code

Supported Entity

Each Supported Entity has the following properties:

Property

Type

Description

name

string

Required; A name of a valid Supported Entity type available in this context

isSearchable

bool

Required; Indicates that this Code is searchable. This should always be true.

isApplicable

bool

Optional; Indicates that this Code can be applied to entities of type name.

Codes

Each list of Codes has the following properties:

Property

Type

Description

code

array

Required; An array of zero or more Code objects for batch operations.