WEBAPI
difference between odata.id and odata.bind. Please explain me which is better and in what situation is used.
*This post is locked for comments
I think you need an extra put request to set the lookup, but you cannot use this format to export data:
msdn.microsoft.com/.../mt607875.aspx
Hi,
i have a question too.
We export dynamics365 crm data like that:
https://xxxxxxxxx.crm4.dynamics.com/api/data/v9.0/accounts?$select=accountid,accountnumber,_parentaccountid_value
but the import with js-webapi9 needs the lookups not in this format:
{ "@odata.context": "assoffice.crm4.dynamics.com/.../v9.0$metadata#accounts(accountid,accountnumber,_parentaccountid_value)", "value": [ { "@odata.etag": "W/\"3179350\"", "accountid": "c42e134c-49ab-e711-a823-000d3a27889d", "accountnumber": "5555444444444", "_parentaccountid_value": "c42e134d-49cb-f711-b823-012d3a25889d" },
no, it needs Lookups in this format:
{ "@odata.context": "assoffice.crm4.dynamics.com/.../v9.0$metadata#accounts(accountid,accountnumber,_parentaccountid_value)", "value": [ { "@odata.etag": "W/\"3179350\"", "accountid": "c42e134c-49ab-e711-a823-000d3a27889d", "accountnumber": "5555444444444", "parentaccountid@odata.bind": "/accounts(ab822393-731c-e811-a84d-000d3a274ce0)" },
So - we need to export the data in the @odata.bind-Format. Then everything is fine.
Is this possible?
many thx.
PeB
Basically there is no general rule. The data model is the basis of an OData service. OData service uses an abstract data model called Entity Data Model (EDM) to describe the exposed data in the service. OData client can issue a GET request to the root URL of the OData service with $metadata to get an XML representation of the service’s data model.
The schema of the MS CRM Web Api is explained a bit here:
msdn.microsoft.com/.../mt607990.aspx
and can be downloaded here:
[Organization URI]/api/data/v8.2/$metadata
So Microsoft defined the schema of their model to request and retrieve data leaned on to the ODATA protocol that can be read on here:
docs.oasis-open.org/.../odata-v4.0-os-part1-protocol.pdf
odata.id is also used in associating records.So why is that used when odata.bind is available
With odata.bind you bind the URI (for a data record) to e.g. a lookup field in a web api request as explained here:
msdn.microsoft.com/.../mt770368.aspx
odata.id you usually retrieved from a response stream, for e.g. lookup field or a collection of records.
if you parse out the odata.id values you can use them in return to do further actions, e.g. sample above.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Andrés Arias as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Aric Levin - MVP 2 Moderator
MA-04060624-0 1