Opportunity Roles

Opportunity Roles Endpoint Reference

The intermediate opportunityRole object links leads to opportunities.

Opportunity Role APIs are available only for subscriptions that do not have native CRM sync enabled.

Describe

As with opportunities, the API provides a Describe call and CRUD operations 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

The dedupeFields and searchableFields values differ from opportunities. dedupeFields provides a compound key that requires externalOpportunityId, leadId, and role. For record creation to succeed, the opportunity and lead referenced by the ID fields must exist in the destination instance.

The searchableFields values marketoGUID, leadId, and externalOpportunityId are valid for individual queries that use the same pattern as Opportunities. You can also query by the compound key. This query requires a JSON object submitted through POST with the _method=GET query parameter.

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 request produces the same response type as a standard GET query but uses a different request interface.

Create and Update

Create and update opportunity roles by using the same interface 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

Delete opportunity roles by dedupe fields or id field. Set the deleteBy parameter to either dedupeFields or idField. The default is dedupeFields.

The request body contains an input array of opportunity roles to delete. Each call permits a maximum of 300 opportunity roles.

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 otherwise noted.
  • Sync Opportunity Roles has a timeout of 60s.
  • Delete Opportunity Roles has a timeout of 60s.
recommendation-more-help
marketo-developer-help