Get Tasks by Opportunity Id

Returns all the tasks created against an opportunity. Specify theOpportunityIdin the API URL. You can get theOpportunityIdfor an opportunity by referring to Get Opportunity by Lead Id.

Note: Tasks that are allowed to be viewed by permission templates alone would be retrieved. In case any task type is restricted to the user, those tasks would not be retrieved as part of the response.

The exceptions are –

Exception Type Exception Message Description
MXInvalidEntityException Not a valid Opportunity Id When an invalid opportunity Id is passed.
MXInvalidEntityException The Opportunity Id ‘111aa1bb-2c22-3d33-4444-eeee5f0fae32’ does not exist in the system When an opportunity does not exist for the opportunity Id provided.
MXUnAuthorizedAccessException You do not have sufficient permissions to access the opportunity When a user does not have permissions to view the opportunity type.
MXUnAuthorizedAccessException You do not have access to view tasks When a user does not have permissions to view any task.
MXUnAuthorizedAccessException You do not have access on Opportunity When a user does not have access for that specific opportunity.

 

API URL

GET
https://{host}/v2/OpportunityManagement.svc/RetrieveTasksByOpportunityId?accessKey=AccessKey&secretKey=SecretKey&opportunityId=opportunityId
Copy URL

URL Parameters

Parameter Description
opportunityId The opportunity Id of that particular opportunity type.

Response

200 OK

Content-Type: application/json

{
   "RecordCount":1,
   "List":[
      {
         "TaskID":"5757eb94-d00b-11ea-9707-0a6d35d1ff1e",
         "Name":"Appointment - CA :",
         "Description":"Appointment with CA",
         "DueDate":"2020-07-27 14:00:39",
         "CreatedOn":"2020-07-27 13:16:11",
         "OwnerID":"97790529-cfce-11ea-9707-0a6d35d1ff1e",
         "OwnerName":"Sri",
         "CreatedBy":"97790529-cfce-11ea-9707-0a6d35d1ff1e",
         "CreatedByName":"Sri",
         "Status":"Pending",
         "Reminder":"0"
      }
   ]
}

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.