Tasks

    Get the tasks for a customer

    This API endpoint is used to list the tasks for a customer list

    Request

    • Method: GET
    • Version: v3, this API call supports additional sort and filter mechanisms as well as retrieving only a sub-set of fields

      Note: This API endpoint supports only read / GET operations.

      Note: In order to access the v3 API endpoints please make sure you have enabled the new rendering engine.

    • Server: https://[app key here]-[site_ID here]-apps.worldsecuresystems.com. Take a look at the Authorize your API calls document for more info on how this URL is formed.
      • Note: When building apps always use relative request URLs. Do not use the "full" URL above because you might have problems running your app on a different site as the site_ID parameter will be different.
    • Path: /webresources/api/v3/sites/current/tasks
      • Alternatively, use siteID instead of 'current'
    • Authorization header: This should contain the authorization token. Here is how to obtain the token.

    Response

    The list of tasks in JSON format.

    • id - the id of the task (integer)
    • siteId - the id of the site (integer)
    • taskTypeid - the type of the task (integer)
      Possible values are:
      • 1 - Task
      • 2 - Call
      • 3 - Meeting
    • objectId - the id of the customer (integer)
    • name - the name of the task(string)
    • description - the description of the task(string)
    • startDate - the start date for the task (date)
    • endDate - the end date for the task(date)
    • reminderDate - the reminder date for the task(date)
    • createDate - the date the note was created (date)
    • percentageComplete - the percentage completed of the task(integer)
    • location - the location of the task(string)
    • taskTypeid - the type of the task (integer)
      Possible values are:
      • 1001 - Individuals
      • 1002 - Companies
    • createDate - the date the task was created (date)
    • lastUpdateDate - the date the task was last updated (date)
    • publicAccess - the public access of the task(boolean)
    • deleted - note status deleted (true / false) (boolean)

    The response is paginated, you can return only a few of the customer's fields. Take a look at the API V3: sorting and filtering for additional switches you can use.

    You can output additional fields to those listed above as default, see the API v3 Discovery APP for additional details.

    Accepts and returns JSON as Content-Type.


    Request:

    GET webresources/api/v3/sites/current/tasks HTTPS/1.1
    Authorization: 14f87f21c5ea4830a06a6314a8aad82b45bc61dc08f24a0fb55599cea83ca811
    Connection: keep-alive
    Content-Type: application/json
    

    Response:

    {
    	 "items": [
            {
                "id": 48129,
                "siteId": 2777580,
                "taskTypeId": 1,
                "objectId": 74847477,
                "name": "task 10.10.2002",
                "description": "task notes for me",
                "startDate": "2020-08-21T09:00:00",
                "endDate": null,
                "remindDate": "2020-08-21T09:00:00",
                "percentageComplete": 10,
                "location": "",
                "objectType": 1001,
                "CreateDate": "2020-08-04T18:14:00.85",
                "lastUpdateDate": "2020-08-04T18:14:00.85",
                "publicAccess": true,
                "deleted": false
            },
            {
                "id": 48130,
                "siteId": 2777580,
                "taskTypeId": 2,
                "objectId": 74847477,
                "name": "close window",
                "description": "",
                "startDate": "2020-08-27T09:00:00",
                "endDate": null,
                "remindDate": null,
                "percentageComplete": 0,
                "location": "",
                "objectType": 1001,
                "CreateDate": "2020-08-04T18:15:19.07",
                "lastUpdateDate": "2020-08-04T18:15:19.07",
                "publicAccess": true,
                "deleted": false
            },
            {
                "id": 48131,
                "siteId": 2777580,
                "taskTypeId": 3,
                "objectId": 74847477,
                "name": "meeting 1",
                "description": "client details",
                "startDate": "2020-08-19T09:00:00",
                "endDate": "2020-08-19T10:00:00",
                "remindDate": "2020-08-19T09:00:00",
                "percentageComplete": 0,
                "location": "downtown",
                "objectType": 1001,
                "CreateDate": "2020-08-04T18:15:53.053",
                "lastUpdateDate": "2020-08-04T18:15:53.053",
                "publicAccess": true,
                "deleted": false
            }
        ],
        "totalItemsCount": 3,
        "skip": 0,
        "limit": 10
    }

    Sample code

    var access_token = BCAPI.Helper.Site.getAccessToken();
    var request = $.ajax({
        url: "/webresources/api/v3/sites/current/tasks",
        type: "GET",
        connection: "keep-alive",    
        contentType: "application/json",
        headers: {
            "Authorization": $.cookie('access_token')
        }
    });
    request.done(function (msg) {
        console.log(msg);
    })
    request.fail(function (jqXHR) {
        console.log("Request failed.");
        console.log("Error code: " + jqXHR.status);
        console.log("Error text: " + jqXHR.statusText);
        console.log("Response text: " + jqXHR.responseText);
    })