Track Definition

Track definitions are templates for creating tracks. They can be applied to opportunities or projects. For a full description of the model see the Track Definition model definition.

List track definitions

List track definitions with the option to filter for track definitions for projects or opportunities.

GET
https://api.capsulecrm.com/api/v2/trackdefinitions

Query Parameters

Name Type Description
type String

List track definitions for projects, opportunities or both. Accepted values are all, kases or opportunities Default: all

page Integer

The page of results to return. Default: 1

perPage Integer

The number of entities to return per page. Value must be between 1 and 100. Default: 50

Response

Returns HTTP status code 200. The body of the response will contain an object with a single property trackDefinitions which is an array of Track Definition objects.

HTTP/1.1 200
Link: <https://api.capsulecrm.com/api/v2/trackdefinitions?page=2>; rel="next"
{
  "trackDefinitions" : [ {
    "id" : 3,
    "description" : "Complaint Process",
    "tag" : "complaint",
    "captureRule" : "OPPORTUNITY",
    "direction" : "START_DATE",
    "createdAt" : "2015-06-04T10:40:20Z",
    "updatedAt" : "2015-06-04T10:40:20Z",
    "taskDefinitions" : [ {
      "id" : 1,
      "description" : "First review",
      "daysAfterRule" : "TRACK_START",
      "daysAfter" : 5,
      "displayOrder" : 1,
      "trackTaskAssignee" : {
        "assigneeType" : "ENTITY_OWNER"
      },
      "dayDelayRule" : "TRACK_DAYS"
    }, {
      "id" : 2,
      "description" : "Escalate to Management Team",
      "daysAfterRule" : "LAST_TASK",
      "daysAfter" : 10,
      "displayOrder" : 2,
      "trackTaskAssignee" : {
        "assigneeType" : "ENTITY_OWNER"
      },
      "dayDelayRule" : "TRACK_WORKDAYS"
    }, {
      "id" : 3,
      "description" : "Escalate to Regulator",
      "daysAfterRule" : "TRACK_START",
      "daysAfter" : 25,
      "displayOrder" : 3,
      "trackTaskAssignee" : {
        "assigneeType" : "ENTITY_OWNER"
      },
      "dayDelayRule" : "TRACK_WEEKS"
    } ]
  } ]
}

Headers:

Name Type Description
Link String

Links to the next and previous pages, encoded as defined in RFC 5988.

Show track definition

Show a specific track definition.

GET
https://api.capsulecrm.com/api/v2/trackdefinitions/{trackDefinitionId}

Response

Returns HTTP status code 200. The body of the response will contain an object with a single property trackDefinition which will contain a Track Definition object.

HTTP/1.1 200
{
  "trackDefinition" : {
    "id" : 3,
    "description" : "Complaint Process",
    "tag" : "complaint",
    "captureRule" : "OPPORTUNITY",
    "direction" : "START_DATE",
    "createdAt" : "2019-10-29T14:37:35Z",
    "updatedAt" : "2019-10-29T14:37:35Z",
    "taskDefinitions" : [ {
      "id" : 3,
      "description" : "First Review",
      "daysAfterRule" : "TRACK_START",
      "daysAfter" : 5,
      "displayOrder" : 1,
      "category" : {
        "id" : 4,
        "name" : "Meeting",
        "colour" : "#a3d11a"
      },
      "trackTaskAssignee" : {
        "assigneeType" : "ENTITY_OWNER"
      },
      "dayDelayRule" : "TRACK_DAYS"
    }, {
      "id" : 4,
      "description" : "Escalate to Management Team",
      "daysAfterRule" : "LAST_TASK",
      "daysAfter" : 10,
      "displayOrder" : 2,
      "category" : {
        "id" : 1,
        "name" : "Call",
        "colour" : "#d1291a"
      },
      "trackTaskAssignee" : {
        "assigneeType" : "ENTITY_OWNER"
      },
      "dayDelayRule" : "TRACK_WORKDAYS"
    }, {
      "id" : 5,
      "description" : "Escalate to Regulator",
      "daysAfterRule" : "TRACK_START",
      "daysAfter" : 25,
      "displayOrder" : 3,
      "trackTaskAssignee" : {
        "assigneeType" : "ENTITY_OWNER"
      },
      "dayDelayRule" : "TRACK_WEEKS"
    } ]
  }
}

Create track definition

Create a track definition.

POST
https://api.capsulecrm.com/api/v2/trackdefinitions
          {
  "trackDefinition" : {
    "description" : "Complaint Process",
    "captureRule" : "OPPORTUNITY",
    "direction" : "START_DATE",
    "tag" : "complaint",
    "taskDefinitions" : [ {
      "description" : "First review",
      "daysAfterRule" : "TRACK_START",
      "daysAfter" : 5,
      "displayOrder" : 1,
      "category" : 4,
      "dayDelayRule" : "TRACK_DAYS",
      "trackTaskAssignee" : {
        "assigneeType" : "ENTITY_OWNER"
      }
    }, {
      "description" : "Escalate to Management Team",
      "daysAfterRule" : "LAST_TASK",
      "daysAfter" : 10,
      "displayOrder" : 2,
      "category" : {
        "name" : "Call"
      },
      "dayDelayRule" : "TRACK_WORKDAYS",
      "trackTaskAssignee" : {
        "assigneeType" : "ENTITY_OWNER"
      }
    }, {
      "description" : "Escalate to Regulator",
      "daysAfterRule" : "TRACK_START",
      "daysAfter" : 25,
      "displayOrder" : 3,
      "dayDelayRule" : "TRACK_WEEKS",
      "trackTaskAssignee" : {
        "assigneeType" : "ENTITY_OWNER"
      }
    } ]
  }
}
        

Response

Returns HTTP status code 201. The body of the response will contain the track definition as it was stored in Capsule.

HTTP/1.1 201
Location: https://api.capsulecrm.com/api/v2/trackdefinitions/3
{
  "trackDefinition" : {
    "id" : 3,
    "description" : "Complaint Process",
    "tag" : "complaint",
    "captureRule" : "OPPORTUNITY",
    "direction" : "START_DATE",
    "createdAt" : "2019-10-29T14:37:35Z",
    "updatedAt" : "2019-10-29T14:37:35Z",
    "taskDefinitions" : [ {
      "id" : 3,
      "description" : "First Review",
      "daysAfterRule" : "TRACK_START",
      "daysAfter" : 5,
      "displayOrder" : 1,
      "category" : {
        "id" : 4,
        "name" : "Meeting",
        "colour" : "#a3d11a"
      },
      "trackTaskAssignee" : {
        "assigneeType" : "ENTITY_OWNER"
      },
      "dayDelayRule" : "TRACK_DAYS"
    }, {
      "id" : 4,
      "description" : "Escalate to Management Team",
      "daysAfterRule" : "LAST_TASK",
      "daysAfter" : 10,
      "displayOrder" : 2,
      "category" : {
        "id" : 1,
        "name" : "Call",
        "colour" : "#d1291a"
      },
      "trackTaskAssignee" : {
        "assigneeType" : "ENTITY_OWNER"
      },
      "dayDelayRule" : "TRACK_WORKDAYS"
    }, {
      "id" : 5,
      "description" : "Escalate to Regulator",
      "daysAfterRule" : "TRACK_START",
      "daysAfter" : 25,
      "displayOrder" : 3,
      "trackTaskAssignee" : {
        "assigneeType" : "ENTITY_OWNER"
      },
      "dayDelayRule" : "TRACK_WEEKS"
    } ]
  }
}

Headers:

Name Type Description
Location String

The URL that identifies the new track definition.

Update track definition

Update the details of a specific track definition. The body must contain an object with a single property trackDefinition which must be a Track Definition object. Fields that are not included in the request will remain unchanged.

To apply changes to entities in the taskDefinitions collection you can do the following:

  • To add a new task definition: include an entity without an id.
  • To update an existing task definition: include the id and any attributes that are being updated.
  • To delete an existing task definition: include the id and the following JSON attribute "_delete": true .

PUT
https://api.capsulecrm.com/api/v2/trackdefinitions/{trackDefinitionId}
          {
  "trackDefinition" : {
    "description" : "Updated Complain Process",
    "taskDefinitions" : [ {
      "id" : 2,
      "_delete" : true
    }, {
      "id" : 3,
      "daysAfter" : 5
    }, {
      "description" : "Escalate to Regulator",
      "daysAfterRule" : "TRACK_START",
      "daysAfter" : 25,
      "displayOrder" : 3,
      "trackTaskAssignee" : {
        "assigneeType" : "ENTITY_OWNER"
      },
      "dayDelayRule" : "TRACK_WEEKS"
    } ]
  }
}
        

Response

Returns HTTP status code 200. All good

HTTP/1.1 200
{
  "trackDefinition" : {
    "id" : 3,
    "description" : "Updated Complaint Process",
    "tag" : "complaint",
    "captureRule" : "OPPORTUNITY",
    "direction" : "START_DATE",
    "createdAt" : "2019-10-29T14:37:35Z",
    "updatedAt" : "2019-10-29T14:37:35Z",
    "taskDefinitions" : [ {
      "id" : 3,
      "description" : "First Review",
      "daysAfterRule" : "TRACK_START",
      "daysAfter" : 5,
      "displayOrder" : 1,
      "category" : {
        "id" : 4,
        "name" : "Meeting",
        "colour" : "#a3d11a"
      },
      "trackTaskAssignee" : {
        "assigneeType" : "ENTITY_OWNER"
      },
      "dayDelayRule" : "TRACK_DAYS"
    }, {
      "id" : 4,
      "description" : "Escalate to Management Team",
      "daysAfterRule" : "LAST_TASK",
      "daysAfter" : 10,
      "displayOrder" : 2,
      "category" : {
        "id" : 1,
        "name" : "Call",
        "colour" : "#d1291a"
      },
      "trackTaskAssignee" : {
        "assigneeType" : "ENTITY_OWNER"
      },
      "dayDelayRule" : "TRACK_WORKDAYS"
    }, {
      "id" : 5,
      "description" : "Escalate to Regulator",
      "daysAfterRule" : "TRACK_START",
      "daysAfter" : 25,
      "displayOrder" : 3,
      "trackTaskAssignee" : {
        "assigneeType" : "ENTITY_OWNER"
      },
      "dayDelayRule" : "TRACK_WEEKS"
    } ]
  }
}

Delete track definition

Delete a track definition.

DELETE
https://api.capsulecrm.com/api/v2/trackdefinitions/{trackDefinitionId}

Response

Returns HTTP status code 204. Returns an empty body if the track definition was successfully deleted.

HTTP/1.1 204