Task

These endpoints allow you to retrieve, create and update tasks. For our users, tasks provide a simple way of creating a reminder of something they need to do. For a full description of the model see the Task model definition.

List Tasks

The collection of Tasks on the Capsule account. By default the body will contain only the open tasks. If you want to retrieve pending and/or completed tasks use the status query parameter

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

Query Parameters

Name Type Description
page Integer

The page of results to return. Default: 1

perPage Integer

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

embed Array of String

Can be used to specify extra entities to fully include in the result. If provided, should be a comma separated list of strings. Accepted values are party, opportunity, kase, owner and nextTask.

status Array of String

Filter the response based on the status of the task. Must be a comma separated list of strings. Accepted values are open, completed and pending. Default: open

Response

Returns HTTP status code 200. The body of the response will contain an object with a single property tasks which is an array of Task objects. In the case of an invalid request, an error message will be returned, as described in the errors section.

HTTP/1.1 200
Link: <https://api.capsulecrm.com/api/v2/tasks?page=4>; rel="next"
{
  "tasks" : [ {
    "id" : 493,
    "category" : {
      "id" : 47,
      "name" : "Billing",
      "colour" : "#d36c00"
    },
    "description" : "Send quarterly invoice",
    "detail" : null,
    "dueTime" : null,
    "status" : "OPEN",
    "party" : {
      "id" : 448322,
      "type" : "organisation",
      "name" : "ABC Furniture",
      "pictureURL" : "https://capsulecrm.com/theme/default/images/org_avatar_70.png"
    },
    "opportunity" : null,
    "owner" : {
      "id" : 1,
      "username" : "owner",
      "name" : "Rupert Ada"
    },
    "daysAfter" : null,
    "taskDelayRule" : null,
    "nextTask" : null,
    "createdAt" : "2015-10-26T14:37:52Z",
    "updatedAt" : "2015-10-26T14:37:52Z",
    "dueOn" : "2015-10-01",
    "completedBy" : null,
    "completedAt" : null,
    "kase" : null,
    "hasTrack" : false,
    "repeat" : {
      "interval" : 3,
      "frequency" : "MONTHLY",
      "on" : "1"
    }
  } ]
}

Headers:

Name Type Description
Link String

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

Show Task

GET
https://api.capsulecrm.com/api/v2/tasks/{taskId}

Query Parameters

Name Type Description
embed Array of String

Can be used to specify extra entities to fully include in the result. If provided, should be a comma separated list of strings. Accepted values are party, opportunity, kase, owner and nextTask.

Response

Returns HTTP status code 200. The body of the response will contain an object with a single property task which is a Task object. In the case of an invalid request, an error message will be returned, as described in the errors section.

HTTP/1.1 200
{
  "task" : {
    "id" : 493,
    "category" : {
      "id" : 47,
      "name" : "Billing",
      "colour" : "#d36c00"
    },
    "description" : "Send quarterly invoice",
    "detail" : null,
    "dueTime" : null,
    "status" : "OPEN",
    "party" : {
      "id" : 448322,
      "type" : "organisation",
      "name" : "ABC Furniture",
      "pictureURL" : "https://capsulecrm.com/theme/default/images/org_avatar_70.png"
    },
    "opportunity" : null,
    "owner" : {
      "id" : 1,
      "username" : "owner",
      "name" : "Rupert Ada"
    },
    "daysAfter" : null,
    "taskDelayRule" : null,
    "nextTask" : null,
    "createdAt" : "2015-10-26T14:37:52Z",
    "updatedAt" : "2015-10-26T14:37:52Z",
    "dueOn" : "2015-10-01",
    "completedBy" : null,
    "completedAt" : null,
    "kase" : null,
    "hasTrack" : false,
    "repeat" : {
      "interval" : 3,
      "frequency" : "MONTHLY",
      "on" : "1"
    }
  }
}

Create task

Creates a new task. The body must contain an object with a single property task which must be a Task object.

POST
https://api.capsulecrm.com/api/v2/tasks
          {
  "task" : {
    "description" : "Email product details",
    "party" : {
      "id" : 11587
    },
    "detail" : null,
    "dueOn" : "2014-05-20",
    "dueTime" : "18:00:48"
  }
}
        

Query Parameters

Name Type Description
embed Array of String

Can be used to specify extra entities to fully include in the result. If provided, should be a comma separated list of strings. Accepted values are party, opportunity, kase, owner and nextTask.

Response

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

HTTP/1.1 201
Location: https://api.capsulecrm.com/api/v2/tasks/530
{
  "task" : {
    "id" : 530,
    "category" : null,
    "description" : "Email product details",
    "detail" : null,
    "dueTime" : "18:00:00",
    "status" : "OPEN",
    "party" : {
      "id" : 11587,
      "type" : "person",
      "firstName" : "Scott",
      "lastName" : "Spacey",
      "pictureURL" : "https://capsulecrm.com/theme/default/images/person_avatar_70.png"
    },
    "opportunity" : null,
    "owner" : {
      "id" : 1,
      "username" : "john",
      "name" : "John Spacey"
    },
    "daysAfter" : null,
    "taskDelayRule" : null,
    "nextTask" : null,
    "createdAt" : "2015-12-21T13:51:38Z",
    "updatedAt" : "2015-12-21T13:51:38Z",
    "dueOn" : "2014-05-20",
    "completedBy" : null,
    "completedAt" : null,
    "kase" : null,
    "hasTrack" : false,
    "repeat" : null
  }
}

Headers:

Name Type Description
Location String

The URL that identifies the new task

Update Task

The body must contain an object with a single property task which must be a Task object. Fields that are not included in the request will remain unchanged.

PUT
https://api.capsulecrm.com/api/v2/tasks/{taskId}
          {
  "task" : {
    "description" : "Email product info",
    "detail" : "Send information about product design and prices"
  }
}
        

Query Parameters

Name Type Description
embed Array of String

Can be used to specify extra entities to fully include in the result. If provided, should be a comma separated list of strings. Accepted values are party, opportunity, kase, owner and nextTask.

Response

Returns HTTP status code 200. The body will contain the details of the updated task.

HTTP/1.1 200
{
  "task" : {
    "id" : 530,
    "category" : null,
    "description" : "Email product info",
    "detail" : "Send information about product design and prices",
    "dueTime" : "18:00:00",
    "status" : "OPEN",
    "party" : {
      "id" : 11587,
      "type" : "person",
      "firstName" : "Scott",
      "lastName" : "Spacey",
      "pictureURL" : "https://capsulecrm.com/theme/default/images/person_avatar_70.png"
    },
    "opportunity" : null,
    "owner" : {
      "id" : 1,
      "username" : "john",
      "name" : "John Spacey"
    },
    "daysAfter" : null,
    "taskDelayRule" : null,
    "nextTask" : null,
    "createdAt" : "2015-12-21T13:51:38Z",
    "updatedAt" : "2015-12-21T13:51:38Z",
    "dueOn" : "2014-05-20",
    "completedBy" : null,
    "completedAt" : null,
    "kase" : null,
    "hasTrack" : false,
    "repeat" : null
  }
}

Delete Task

Fully delete the specific task from capsule.

DELETE
https://api.capsulecrm.com/api/v2/tasks/{taskId}

Response

Returns HTTP status code 204. The response will contain an empty body.

HTTP/1.1 204