We currently have an integration that enhances lead data through a webhook. It makes use of the Payload Template to pass the information needed to our application which works beautifully. The payload template string is built by our application for our users to paste into the webhook definition based on their field selections. This is currently done using the describeMObject SOAP API to get the field definitions.
We are now trying to switch over to using the REST API and, therefore, need to obtain the fields using the Describe endpoint. However, the Describe endpoint does not return all the information that we require. This is preventing us from building the field tokens for the payload template. The specific piece that we require is the sourceObject value (Lead, Company, etc.) which is combined with the displayName to build the token.
Consider the tokens for Address and Company:
{{Lead.Address}} and {{Company.Company Name}}
Using the describeMObject SOAP API call we get the following response for Address and Company:
<MObjFieldMetadata>
<name>Address</name>
<description />
<displayName>Address</displayName>
<sourceObject>Lead</sourceObject>
<dataType>text</dataType>
<size>2000</size>
<isReadonly>false</isReadonly>
<isUpdateBlocked>false</isUpdateBlocked>
<isName />
<isPrimaryKey>false</isPrimaryKey>
<isCustom>false</isCustom>
<isDynamic>true</isDynamic>
<dynamicFieldRef>leadAttributeList</dynamicFieldRef>
<updatedAt>2014-03-25T18:07:35-04:00</updatedAt>
</MObjFieldMetadata>
<MObjFieldMetadata>
<name>Company</name>
<description />
<displayName>Company Name</displayName>
<sourceObject>Company</sourceObject>
<dataType>string</dataType>
<size>255</size>
<isReadonly>false</isReadonly>
<isUpdateBlocked>false</isUpdateBlocked>
<isName />
<isPrimaryKey>false</isPrimaryKey>
<isCustom>false</isCustom>
<isDynamic>true</isDynamic>
<dynamicFieldRef>leadAttributeList</dynamicFieldRef>
<updatedAt>2014-03-25T18:07:35-04:00</updatedAt>
</MObjFieldMetadata>
Using the Describe endpoint from the REST API we get the following response for Address and Company:
{
"id": 60,
"displayName": "Address",
"dataType": "text",
"length": 0,
"rest": {
"name": "address",
"readOnly": false
},
"soap": {
"name": "Address",
"readOnly": false
}
}
{
"id": 2,
"displayName": "Company Name",
"dataType": "string",
"length": 255,
"rest": {
"name": "company",
"readOnly": false
},
"soap": {
"name": "Company",
"readOnly": false
}
}
My question is: How can I get the sourceObject value using the REST API?