Recently we had a project that utilized the Dynamics 365 API extensively. The best practice of course in this types of scenario is to have as few API requests as possible.
In creating Dynamics 365 records using the API, you can create the record and the related entities in one operation. See: https://msdn.microsoft.com/en-us/library/gg328090.aspx
Trying this however, we always got an Error 400 (Bad Request) from the API.
The reason is… we were using the field’s Logical Name when we should be using the Schema Name.
In the image below, there is a Main Record and a Related Record.
The Main Record has a lookup to the Related Record named Message Type ID
- Logical Name: smsmt_messagetypeid
- Schema Name: smsmt_MessageTypeId
When the lookup field has been changed to schema name, it returned a success
TIP: When creating the Dynamics 365 attributes, make your Schema Name all lowercase.
It will save you a lot of trouble.