LeadSquared Developer Centre

ON THIS PAGE

Opportunity Advanced Search


Lets you retrieve Opportunities using the advanced search criteria.

  • This API is only accessible to Administrator users.
  • OpportunityEventandAdvancedSearchare mandatory fields.
  • The AdvancedSearch criteria can be captured using theOpportunityGridnetwork call.
    1. Navigate to Leads>Manage Opportunities>Opportunity Type.
    2. From the Opportunity Grid, open your browser’s developer tools.
    3. Navigate to the Network tab, and search for ActivityGrid.
    4. From Form Data, copy theAdvancedSearchparameter value.
    5. You may have to use escape characters in the JSON (replace ” with \”). After you add it, then pass it in theAdvancedSearchparameter in the JSON payload.

Opportunity Advanced Search_1

Notes:

  • For ESS customers, custom field sets are represented as mx_Custom_3~mx_CustomObject_1. Note that the “~” symbol may be shown in hexadecimal form as x007E. Please get in touch with your account manager to know whether your account has ESS enabled.
  • The time zone considered is Universal Time Coordinated (UTC). You may need to convert the time from your local time zone to UTC before passing it here.

 

API URL

URL
Icon
POST https://{host}/v2/OpportunityManagement.svc/Retrieve/BySearchParameter?accessKey=AccessKey&secretKey=SecretKey

Request

Content-Type: application/json
JSON Body/Payload Icon
{
   "OpportunityEventCode":12005,
   "AdvancedSearch":"{\"GrpConOp\":\"And\",\"Conditions\":[{\"Type\":\"Activity\",\"ConOp\":\"and\",\"RowCondition\":[{\"SubConOp\":\"And\",\"LSO\":\"ActivityEvent\",\"LSO_Type\":\"PAEvent\",\"Operator\":\"eq\",\"RSO\":\"12005\"}]}],\"QueryTimeZone\":\"India Standard Time\"}",
   "Paging":{
      "PageIndex":1,
      "PageSize":10
   },
   "Sorting":{
      "ColumnName":"CreatedOn",
      "Direction":1
   }
}

Request Parameters

Parameter Description
OpportunityEventCode

The code for the opportunity type. To find it, navigate to My Profile>Settings>Opportunities>Opportunity Type. It is listed under the column Code.

This is a mandatory field.

AdvancedSearch

The advanced search criteria can be captured using the Activity Grid network call. See the process above for details.

This is a mandatory field.

Paging

PageIndex and PageSize – 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”.

Note: Default page size is 25. Maximum page size is 1,000.

Sorting

ColumnName – The column on which results will be sorted. For example, if you want results to be shown based on creation date, pass “CreatedOn”.

Direction – Direction “1” means descending order, while “0” means ascending order.

Note: Default sorting is on activity ModifiedOn column as descending order

Response

200 OK
Content-Type: application/json
{
   "RecordCount":3,
   "List":[
      {
         "OpportunityEventType":"2",
         "OpportunityEvent":"12005",
         "CreatedOn":"2020-11-05 10:28:26",
         "ModifiedOn":"2020-12-10 10:10:28",
         "mx_Custom_1":"Rahul Sen - Loan",
         "Status":"Open",
         "mx_Custom_2":"Need Analysis",
         "mx_Custom_6":"312500",
         "mx_Custom_8":"2020-12-24 10:10:00",
         "Owner":"a4dfa1c5-c6d2-11ea-92ae-0a6d35d1ff1e",
         "RelatedProspectId":"83543043-91d1-4ca1-926b-aad0bab94f7e",
         "OpportunityId":"c005f516-f2ca-41dd-a1cf-0993a22fbd3b"
      },
      {
         "OpportunityEventType":"2",
         "OpportunityEvent":"12005",
         "CreatedOn":"2020-11-05 10:25:20",
         "ModifiedOn":"2020-12-10 10:10:08",
         "mx_Custom_1":"Arjun Shetty - Loan",
         "Status":"Lost",
         "mx_Custom_2":"Decided not to buy",
         "mx_Custom_6":"145000",
         "mx_Custom_8":"2020-11-11 10:09:00",
         "Owner":"a4dfa1c5-c6d2-11ea-92ae-0a6d35d1ff1e",
         "RelatedProspectId":"83543043-91d1-4ca1-926b-aad0bab94f7e",
         "OpportunityId":"7dfcdae7-f2c3-4a8b-8f85-bbe603ed7bb7"
      },
      {
         "OpportunityEventType":"2",
         "OpportunityEvent":"12005",
         "CreatedOn":"2020-09-16 05:44:47",
         "ModifiedOn":"2020-10-16 06:10:54",
         "mx_Custom_1":"Manish Garg - Loan",
         "Status":"Won",
         "mx_Custom_2":"Closed - Won",
         "mx_Custom_6":"2500000",
         "mx_Custom_8":"2020-11-06 05:45:00",
         "Owner":"a4dfa1c5-c6d2-11ea-92ae-0a6d35d1ff1e",
         "RelatedProspectId":"69e1c27e-dd08-4b53-b509-f353ad1c7f4d",
         "OpportunityId":"4597c076-be5a-4ba2-9b08-ecd21626750f"
      }
   ]
}

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

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