Each attribute in Dynamics CRM has a logical name and a schema name.
For example, on the opportunity entity, we have the parent account with:
Logical name: parentaccountid
Schema name: ParentAccountId
The entity definition provides both (xxx.api.crm4.dynamics.com/api/data/v9.1/EntityDefinitions(LogicalName='opportunity')?$select=LogicalName&$expand=Attributes)
Logical names are generally lower case whereas schema names include Capitalization.
When using $filter in GET requests (and using Filter Query in Common Data Service List Records(current environment)), the problem is that if you want to filter on lookup fields (foreign keys), the rules for knowing whether to use the schema name or logical name are frustratingly complicated.
System defined lookup attributes – use the logical name for both the lookup attribute and the attribute name in the lookup entity.
e.g. xxx.dynamics.com/api/data/v9.1/opportunities?$filter=parentaccountid/accountid eq ‘fd780aee-8222-ea11-a810-000d3ab550da’
Custom lookup attributes – use the schema name for the lookup attribute and the logical name for the attribute in the lookup entity