LeadSquared Developer Centre

ON THIS PAGE

Create a To-Do


Lets you create a new to-do type task. There are 3 ways to use this API –

  • To create a task and associate it with a lead, pass the RelatedEntity parameter as “1”, and then pass the LeadId as the value for the RelatedEntityId parameter. To obtain the LeadId, refer to any of the Get Lead APIs.
  • To create a task and associate it with an opportunity, pass the RelatedEntity parameter as “5”, and then pass the OpportunityId as the value for the RelatedEntityId parameter. To obtain the OpportunityId, refer to Get Opportunities by Lead Id.
  • You can create a task without associating it with a lead or an opportunity. In this case, pass the RelatedEntity parameter as 0 and don’t pass any value for the RelatedEntityId parameter.

You can either provide the OwnerId or OwnerEmailAddress in the JSON body. The TaskType is the type of task you want to create. To retrieve the list of task types, use the Get list of Task Types API.

Note:

  • The supported DateTime format is UTC (YYYY-MM-DD HH:MM:SS).
  • The DueDate and EndDate parameters are optional. If you don’t pass them, the due date will be taken as the current day and the appointment will be created with the default duration specified in the task type configuration.

 

API URL

URL
Icon
POST https://{host}/v2/Task.svc/Create?accessKey=AccessKey&secretKey=SecretKey

Request

Content-Type: application/json
JSON Body/Payload Icon
{
  "Name": "Todo: Item",
  "Description": "Describing the task",
  "RelatedEntity": 0,
  "RelatedEntityId": "",
  "DueDate": "2020-11-11 10:30:00",
  "EndDate": "2020-11-12 10:29:00",
  "ReminderBeforeDays": "1",
  "ReminderTime": "10:00:00",
  "NotifyBy": "1100",
  "OwnerEmailAddress": " taskowner@example.com",
  "TaskType": {
    "Name": "Revive Old Lead"
  }
}

Request Parameters

Parameter Description
Name

Name of the task. You may pass any string value here.

Description

Description of the task.

RelatedEntity

Pass “1” if you’re passing the LeadId.

Pass “5” if you’re passing the OpportunityId.

Pass “0” if you’re not passing any value.

RelatedEntityId

The LeadId or OpportunityId you want to associate the task with.

DueDate

Due date of task in UTC (YYYY-MM-DD HH:MM:SS).

EndDate

The end date of the task in UTC (YYYY-MM-DD HH:MM:SS). The task will remain ‘Pending’ until the end date, after which it will become ‘Overdue’.

ReminderBeforeDays

The number of days before the due date you want the task owner to receive a reminder.

ReminderTime

The reminder will be received by the task owner at the time specified here* on the day specified in the “ReminderBeforeDays” parameter.

*time must be passed in “hh:mm:ss” format.

NotifyBy

Set the value as 1100 if you want the task owner to be notified by email.

Set the value as 1000 if you don’t want any notifications.

OwnerId

Id of the user you’re assigning the task to. You may pass either this or the “OwnerEmailAddress”.

OwnerEmailAddress

Email address of the user you’re assigning the task to (when “OwnerId” is not known).

Response

200 OK
Content-Type: application/json
{
   "Status":"Success",
   "Message":{
              "Id":"xxxxxxxx-Task-Idxx-xxxx-xxxxxxxxxxxx"
             }
}

HTTP Response Codes

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.

On this page

© 2022 by MarketXpander Services Pvt Ltd. All Rights Reserved.