51黑料不打烊

Opportunity Roles

Leads are linked to opportunities via the intermediate opportunityRole object.

Opportunity Role APIs are only exposed for subscriptions which do not have a native CRM sync enabled.

Describe

Like opportunities, a describe call and CRUD operations are exposed for opportunity roles.

GET /rest/v1/opportunities/roles/describe.json
{
   "requestId":"185d6#14b51985ff0",
   "success":true,
   "result":[
      {
         "name":"opportunityRole",
         "displayName":"Opportunity Role",
         "createdAt":"2015-02-03T22:36:23Z",
         "updatedAt":"2015-02-03T22:36:24Z",
         "idField":"marketoGUID",
         "dedupeFields":[
            "externalOpportunityId",
            "leadId",
            "role"
         ],
         "searchableFields":[
            [
               "externalOpportunityId",
               "leadId",
               "role"
            ],
            [
               "marketoGUID"
            ],
            [
               "leadId"
            ],
            [
               "externalOpportunityId"
            ]
         ],
         "fields":[
            {
               "name":"marketoGUID",
               "displayName":"Marketo GUID",
               "dataType":"string",
               "length":36,
               "updateable":false
            },
            {
               "name":"externalOpportunityId",
               "displayName":"External Opportunity Id",
               "dataType":"string",
               "length":50,
               "updateable":false
            },
            {
               "name":"leadId",
               "displayName":"Lead Id",
               "dataType":"integer",
               "updateable":false
            },
            {
               "name":"role",
               "displayName":"Role",
               "dataType":"string",
               "length":50,
               "updateable":false
            },
            {
               "name":"isPrimary",
               "displayName":"Is Primary",
               "dataType":"boolean",
               "updateable":true
            },
            {
               "name":"externalCreatedDate",
               "displayName":"External Created Date",
               "dataType":"datetime",
               "updateable":true
            }
         ]
      }
   ]
}

Query

Notice that both dedupeFields and searchableFields are a little different from opportunities. dedupeFields actually provides a compound key, where all three of externalOpportunityId, leadId, and role are required. Both the opportunity and lead link by the id fields must exist in the destination instance, for record creation to succeed. For searchableFields, marketoGUID, leadId, and externalOpportunityId are all valid for queries on their own and use a pattern identical to Opportunities, but there is an additional option of using the compound key to query, which requires submitting a JSON object via POST, with the additional query parameter _method=GET.

POST /rest/v1/opportunities/roles.json?_method=GET
{
   "filterType": "dedupeFields",
   "fields": [
      "marketoGuid",
      "externalOpportunityId",
      "leadId",
      "role"
   ],
   "input": [
      {
        "externalOpportunityId": "Opportunity1",
        "leadId": 1,
        "role": "Captain"
      },
      {
        "externalOpportunityId": "Opportunity2",
        "leadId": 1872,
        "role": "Commander"
      },
      {
        "externalOpportunityId": "Opportunity3",
        "leadId": 273891,
        "role": "Lieutenant Commander"
      }
   ]
}

This produces the same type of response as a standard GET query, it simply has a different interface for making the request.

Create and Update

Opportunity roles have the same interface for creating and updating records as opportunities.

POST /rest/v1/opportunities/roles.json
{
   "action": "createOrUpdate",
   "dedupeBy": "dedupeFields",
   "input": [
      {
         "externalOpportunityId": "19UYA31581L000000",
         "leadId": 456783,
         "role": "Technical Buyer",
         "isPrimary": false
      },
      {
         "externalOpportunityId": "19UYA31581L000000",
         "leadId": 456784,
         "role": "Technical Buyer",
         "isPrimary": false
      }
   ]
}
{
   "requestId": "e42b#14272d07d78",
   "success": true,
   "result":[
      {
         "seq": 0,
         "status": "updated",
         "marketoGUID": "dff23271-f996-47d7-984f-f2676861b5fb"
      },
      {
         "seq": 1,
         "status": "created",
         "marketoGUID": "cff23271-f996-47d7-984f-f2676861b5fb"
      }
   ]
}

Delete

You may delete opportunity roles by dedupe fields or id field. Specify using the deleteBy聽parameter with a value of either dedupeFields or idField. If not specified, the default is dedupeFields. The request body contains an聽input array of opportunity roles to delete. A maximum of 300 opportunity roles per call is permitted.

POST /rest/v1/opportunities/roles/delete.json
{
   "deleteBy": "dedupeFields",
   "input": [
      {
        "externalOpportunityId": "19UYA31581L000000",
        "leadId": 456783,
        "role": "Technical Buyer"
      }
   ]
}
{
    "requestId": "10f7c#173264db42d",
    "result": [
        {
            "seq": 0,
            "marketoGUID": "dff23271-f996-47d7-984f-f2676861b5fb"
            "status": "deleted"
        }
    ]
    "success": true
}

Timeouts

  • Opportunity Role endpoints have a timeout of 30s unless noted below

    • Sync Opportunity Roles: 60s
    • Delete Opportunity Roles: 60s
recommendation-more-help
bb269a6d-047a-4bf7-9acd-23ad9a63dc59