I'm trying to build an ETL/ELT application using the Dataverse Web API and I'm having a problem with figuring out what fields/attributes/columns will be returned for a given entity/table. I've used the `EntityDefinitions` metadata endpoint with the $expand query param for the Attributes to try and determine this, but Im unable to determine what combination of `IsValidForRead` and `IsRetrievable` (or other) properties would get me the attributes/columns that I would get when calling a specific entity endpoint.
As an example in the "contact" entity/table the `parentcustomerid` attribute has the value of "true" for both the `IsValidForRead` and `IsRetrievable` properties, but doesn't show up when you call the contact endpoint and causes an error if included in the $select query param. Is there a way to figure out what fields/columns will be returned for a given entity endpoint using the metadata for that endpoint? I'm not very familiar with the Dynamics data model or product and any help would be greatly appreciated!
I'm using the Microsoft sample dataset (if that matters). Here's the full metadata for attribute:
{
"@odata.type": "#Microsoft.Dynamics.CRM.LookupAttributeMetadata",
"MetadataId": "c7a58b13-df19-491c-a918-1bc26eaf6eb3",
"HasChanged": null,
"AttributeOf": null,
"AttributeType": "Customer",
"ColumnNumber": 179,
"DeprecatedVersion": null,
"IntroducedVersion": "5.0.0.0",
"EntityLogicalName": "contact",
"IsCustomAttribute": false,
"IsPrimaryId": false,
"IsValidODataAttribute": true,
"IsPrimaryName": false,
"IsValidForCreate": true,
"IsValidForRead": true,
"IsValidForUpdate": true,
"CanBeSecuredForRead": false,
"CanBeSecuredForCreate": false,
"CanBeSecuredForUpdate": false,
"IsSecured": false,
"IsRetrievable": true,
"IsFilterable": false,
"IsSearchable": true,
"IsManaged": true,
"LinkedAttributeId": null,
"LogicalName": "parentcustomerid",
"IsValidForForm": true,
"IsRequiredForForm": false,
"IsValidForGrid": true,
"SchemaName": "ParentCustomerId",
"ExternalName": null,
"IsLogical": false,
"IsDataSourceSecret": false,
"InheritsFrom": null,
"CreatedOn": "1900-01-01T00:00:00Z",
"ModifiedOn": "1900-01-01T00:00:00Z",
"SourceType": null,
"AutoNumberFormat": "",
"Targets": [
"account",
"contact"
],
"Format": "None",
"AttributeTypeName": {
"Value": "CustomerType"
},
"Description": {
"LocalizedLabels": [
{
"Label": "Select the parent account or parent contact for the contact to provide a quick link to additional details, such as financial information, activities, and opportunities.",
"LanguageCode": 1033,
"IsManaged": true,
"MetadataId": "6391aa12-2341-db11-898a-0007e9e17ebd",
"HasChanged": null
}
],
"UserLocalizedLabel": {
"Label": "Select the parent account or parent contact for the contact to provide a quick link to additional details, such as financial information, activities, and opportunities.",
"LanguageCode": 1033,
"IsManaged": true,
"MetadataId": "6391aa12-2341-db11-898a-0007e9e17ebd",
"HasChanged": null
}
},
"DisplayName": {
"LocalizedLabels": [
{
"Label": "Company Name",
"LanguageCode": 1033,
"IsManaged": true,
"MetadataId": "6291aa12-2341-db11-898a-0007e9e17ebd",
"HasChanged": null
}
],
"UserLocalizedLabel": {
"Label": "Company Name",
"LanguageCode": 1033,
"IsManaged": true,
"MetadataId": "6291aa12-2341-db11-898a-0007e9e17ebd",
"HasChanged": null
}
},
"IsAuditEnabled": {
"Value": true,
"CanBeChanged": true,
"ManagedPropertyLogicalName": "canmodifyauditsettings"
},
"IsGlobalFilterEnabled": {
"Value": true,
"CanBeChanged": true,
"ManagedPropertyLogicalName": "canmodifyglobalfiltersettings"
},
"IsSortableEnabled": {
"Value": false,
"CanBeChanged": true,
"ManagedPropertyLogicalName": "canmodifyissortablesettings"
},
"IsCustomizable": {
"Value": true,
"CanBeChanged": false,
"ManagedPropertyLogicalName": "iscustomizable"
},
"IsRenameable": {
"Value": true,
"CanBeChanged": false,
"ManagedPropertyLogicalName": "isrenameable"
},
"IsValidForAdvancedFind": {
"Value": true,
"CanBeChanged": true,
"ManagedPropertyLogicalName": "canmodifysearchsettings"
},
"RequiredLevel": {
"Value": "None",
"CanBeChanged": true,
"ManagedPropertyLogicalName": "canmodifyrequirementlevelsettings"
},
"CanModifyAdditionalSettings": {
"Value": true,
"CanBeChanged": false,
"ManagedPropertyLogicalName": "canmodifyadditionalsettings"
}
}