Leads With No Active Tasks

This API retrieves leads with no active tasks. Only tasks that are completed and canceled are returned. To retrieve tasks that are Pending and Overdue, use the Leads With Pending/Overdue Tasks API.

 

Example Use Cases

  • Get leads with pending and overdue tasks of a particular task type.
  • Get leads with pending and/or overdue tasks in the last month.
  • Get leads in a particular stage (prospect, opportunity, etc.) who have pending tasks in a given time frame.

 

Structure of the API

The API structure consists of report filters (consisting of user, lead and task filters), date filters, output conditions, and response format.

  1. The “Report Filter” node contains “UserFilter”“LeadFilters” and “Task Filters” parameters.
    • The “UserFilter” lets you use condition groups (see User Advanced Search) to filter users.
    • The “LeadFilters” lets you filter based on any lead field.
    • The “TaskFilters” lets you specify task types and statuses.
      • If no task type is specified, all tasks types will be returned.
  2. The “DateFilter” node lets you filter based on a particular date field (modified on, created on, etc.) and range.
  3. The “Output” node lets you control how you want the results to be displayed.
    1. You can retrieve results as a ‘list’ of leads
    2. Or you can use the ‘aggregate’ option to perform operations like averaging or summing up a particular lead field (lead score, engagement score, etc.). This option is more relevant for the Lead Distribution Analytics API.
  4. “Paging” options are used the same way across all our APIs. Use them to sort your results.

Note: The “ResponseFormat” parameter in the API URL lets you retrieve results in either JSON (default) or CSV formats.

 

API URL

POST
https://{host}/Tasks/LeadsWithNoActiveTasks?accessKey=AccessKey&secretKey=SecretKey&responseformat=ResponseFormat
Copy URL

URL Parameters

Parameter Description
ResponseFormat The response can be displayed in either JSON (default) or CSV formats. The response Content-Type will be “text/csv” in case of CSV response format. The CSV attachment can be downloaded.

Request

JSON Body/Payload

Content-Type: application/json

{
  "ReportFilter": {
    "UserFilter": {
      "GroupConditions": [
        {
          "Condition": [
            {
              "LookupName": "UserID",
              "Operator": "eq",
              "LookupValue": "01f131a5-7746-11e6-bcaf-0677ec402fcf,07934579-8551-11e6-88b9-0677ec402fcf,090529bc-862c-11e6-88b9-0677ec402fcf,0ec2b1d5-3d0f-11e5-b982-22000aa68b6f"
            }
          ]
        }
      ]
    },
    "LeadFilters": [
      {
        "LookUpName": "EngagementScore",
        "LookUpValue": "0",
        "SqlOperator": "<>"
      }
    ],
    "TaskFilters": [
      {
        "LookUpName": "TaskType",
        "LookUpValue": "23de6273-3cda-11e5-b982-22000aa68b6f",
        "SqlOperator": "="
      }
    ]
  },
  "DateFilter": [
    {
      "DateField": "LeadCreatedOn",
      "FromDate": "2017-11-10 12:10:00",
      "ToDate": "2018-11-10 12:00:00"
    }
  ],
  "Output": {
    "Type": "Aggregate|List",
    "GroupBy": "OwnerId",
    "AggregateFunction": "Count|Average|Sum",
    "AggregateField": "EngagementScore",
    "IncludeCSV": "ProspectID,FirstName"
  },
  "Paging": {
    "PageIndex": 1,
    "PageSize": 10
  }
}

JSON Properties

Parameter Description
User Filter

You can enter multiple User Ids/Email Addresses or use advanced search conditions.

If no user filter is specified, all users will be considered.

Lead Filters

You can enter multiple lead field filters separated by AND condition.

  • “LookupName” – Schema name of the lead field. For example, “EngagementScore”.
    To get the schema names for all lead fields use the LeadsMetaData API.
  • “LookupValue” – This is the value of the field you passed in “LookupName”.
  • “SQLOperator”
    Operator Accepted Value in API
    Equals =
    Greater than >
    Less than <
    Greater than equal to >=
    Less than equal to <=
    Contains data def
    Doesn’t contain data ndef
    Contains lik
    Doesn’t contain nlik
    In in*

    If you use the SQL operator in, you can specify multiple values in the LookupValues array. For example –
    {
    “LookUpName”: “EngagementScore”,
    “SqlOperator”: “in”,
    “LookUpValues”: [
    “0”,
    “9”
    ]
    }

Note: For an exact match pass “SqlOperator”:”=”

Task Filters

You can pass task types here. For the complete list of task types, see Get List of Tasks Types API.

  • “LookupName” – Only allowed value is “TaskType” 
  • “LookupValue” – Pass the task type Id here.
  • “SQLOperator” – For tasks type you can use the following operators =, <>, in.

Note: In case of ‘in’ operator – LookUpValues[] is considered, otherwise LookUpValue is considered

Date Filter

Lets you filter leads and tasks on a particular date field. Multiple date filters are permitted.

  • “DateField” – The date field you want to filter on. Allowed values are “LeadCreatedOn” and “LeadModifiedOn” and “TaskCreatedOn”.
  • “FromDate” – The start date you want to filter from.
  • “ToDate” – The end date you want to filter till.

Note: The date format must be yyyy-MM-dd hh:mm:ss

Output

“Type” – You can receive the output as either

  • “List” – Leads will be displayed as a list. If you use this option, it is mandatory to pass the “IncludeCSV” parameter to specify the lead fields you want to include in the response.
    “GroupBy”, “AggregateFunction” and “AggregateField” parameters won’t be considered.
  • “Aggregate” – If you use this option, it is mandatory to pass “GroupBy”, “AggregateFunction” and “AggregateField”.
    • “GroupBy” – Enter the lead field you want to group the results by. For example, “OwnerId”, “ProspectStage” etc.
    • “AggregateFunction” and “AggregateField” – Accepted values are
      • “Count” (returns count of leads),
      • “Average” (returns count of leads and average of AggregateField such as Score/EngagementScore, etc.)
      • “Sum” – (returns count of leads and sum of AggregateField such as Score/EngagementScore. etc.)
Paging

The results matching your criteria may be large. You can fetch the result in blocks of “PageSize” and make multiple calls to the API with increasing values of “PageIndex”.  For example, you can specify “PageIndex”: 1, “PageSize”: 100 for the first call and specify “PageIndex”: 2, “PageSize”: 100 for second call.

Response

200 OK

Content-Type: application/json

{
  "TotalCount": "99314",
  "Results": [
    {
      "OwnerIdEmailAddress": "bhargavi.mainjee@mailinator.com",
      "ProspectAutoId": 2013008,
      "ModifiedOn": "2018-03-27 13:43:55",
      "FacebookId": null,
      "OwnerIdName": "Bhargavi 1221",
      "CreatedOn": "2018-03-27 13:43:55",
      "LeadLastModifiedOn": "2018-03-27 13:57:00",
      "ProspectStage": "Hot",
      "EngagementScore": 0,
      "Notes": null,
      "EmailAddress": "bhargavi.d50957@mailinator.dom",
      "ProspectID": "c30a298a-31c4-11e8-a45f-06668308c05a"
    },
    {
      "OwnerIdEmailAddress": "bhargavi.mainjee@mailinator.com",
      "ProspectAutoId": 2013009,
      "ModifiedOn": "2018-03-27 13:43:55",
      "FacebookId": null,
      "OwnerIdName": "Bhargavi 1221",
      "CreatedOn": "2018-03-27 13:43:55",
      "LeadLastModifiedOn": "2018-03-27 13:57:00",
      "ProspectStage": "Hot",
      "EngagementScore": 0,
      "Notes": null,
      "EmailAddress": "bhargavi.d50958@mailinator.dom",
      "ProspectID": "c30a2a3f-31c4-11e8-a45f-06668308c05a"
    },
    {
      "OwnerIdEmailAddress": "bhargavi.mainjee@mailinator.com",
      "ProspectAutoId": 2013012,
      "ModifiedOn": "2018-03-27 13:43:55",
      "FacebookId": null,
      "OwnerIdName": "Bhargavi 1221",
      "CreatedOn": "2018-03-27 13:43:55",
      "LeadLastModifiedOn": "2018-03-27 13:57:00",
      "ProspectStage": "Hot",
      "EngagementScore": 0,
      "Notes": null,
      "EmailAddress": "bhargavi.d50961@mailinator.dom",
      "ProspectID": "c30a2c83-31c4-11e8-a45f-06668308c05a"
    },
    {
      "OwnerIdEmailAddress": "bhargavi.mainjee@mailinator.com",
      "ProspectAutoId": 2013014,
      "ModifiedOn": "2018-03-27 13:43:55",
      "FacebookId": null,
      "OwnerIdName": "Bhargavi 1221",
      "CreatedOn": "2018-03-27 13:43:55",
      "LeadLastModifiedOn": "2018-03-27 13:57:00",
      "ProspectStage": "Hot",
      "EngagementScore": 0,
      "Notes": null,
      "EmailAddress": "bhargavi.d50963@mailinator.dom",
      "ProspectID": "c30a2e1a-31c4-11e8-a45f-06668308c05a"
    },
    {
      "OwnerIdEmailAddress": "bhargavi.mainjee@mailinator.com",
      "ProspectAutoId": 2013015,
      "ModifiedOn": "2018-03-27 13:43:55",
      "FacebookId": null,
      "OwnerIdName": "Bhargavi 1221",
      "CreatedOn": "2018-03-27 13:43:55",
      "LeadLastModifiedOn": "2018-03-27 13:57:00",
      "ProspectStage": "Hot",
      "EngagementScore": 0,
      "Notes": null,
      "EmailAddress": "bhargavi.d50964@mailinator.dom",
      "ProspectID": "c30a2edb-31c4-11e8-a45f-06668308c05a"
    }
  ]
}

HTTP Response Code

Code Description
200 OK

This is the status code for successful API call.

401 Unauthorized

The API call was made with invalid access credentials. Check your AccessKey and SecretKey.

400 Bad Request

The message body on the request is not as per API specification. Make sure that content type is set to “application/json” and the JSON body has correct attribute names and structure.

404 Not Found

The API could not be found. Please check the API signature.

429 Too Many Requests

API calls exceeded the limit of 25 in 5 second(s)

500 Internal Server Error

The API called failed. There could be many reasons for it. Check the exception message to get more details.