Whenever I open up an Opportunity, under the Activity tab there are 3 things which I can do

Log a Call New Task New Event

Is there any API documentation to do so via an API call? I've searched high and low and even under the API documentation for Opportunity, it doesn't seem to return anything related to Activity except Last Activity Date.

Also, is there any way to search for Opportunity associated with any contact via REST API call?

1 Answer 1


To create records, you use the sObject Create REST call. Task and Event objects are their own separate entities, as they can be associated with many types of objects, not just opportunities. For example, you can create activity records for a case, an opportunity, a lead, and even custom objects. Similarly, to find records, you use a record query REST call. You'll need to learn about SOQL in order to write valid queries.

  • Got it! I'll need to pass AccountId while creating a Task, and AccountID will be returned by SOQL like below - SELECT Id, Name, (SELECT Id, Name FROM Opportunities) FROM Contact WHERE Email = '[email protected]' AND Id IN (SELECT ContactId FROM OpportunityContactRole) Jul 9, 2019 at 13:40
  • @angular.aditya AccountId is automatically populated by the system. You simply need to set WhatId and WhoId appropriately.
    – sfdcfox
    Jul 9, 2019 at 13:43
  • Great! thanks, is there a way to search a contact / lead from phone / mobile number? Jul 9, 2019 at 13:50
  • @angular.aditya Yes, there's a search API as well. It's all in the documentation.
    – sfdcfox
    Jul 9, 2019 at 14:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .