In our solution, we are building HTTP/ODATA requests dynamically.
For example, we will build a URL that looks like this:
[http://org....api/v8.1/]accounts(00000000-0000-0000-0000-000000000001)/primarycontactid?$select=fullname
How do we dynamically get a list of all the entities such as 'accounts'?
In 2011, we would simply execute against LeadSet/AccountSet/etcSet, what is the strategy in 2016?
I don't know if there is some "language" trick (obviously the name of the set is just plural name in english of the entity, but that's not good enough for me), so I it like that - simply call webAPI metadata:
http://[crmurl]/api/data/v8.2/EntityDefinitions?$select=EntitySetName,LogicalName&$filter=LogicalName eq 'account'
result is the following:
{
"@odata.context":"http://[crmurl]/api/data/v8.2/$metadata#EntityDefinitions(EntitySetName,LogicalName)","value":[
{
"EntitySetName":"accounts","LogicalName":"account","MetadataId":"70816501-edb9-4740-a16c-6a5efbc05d84"
}
]
}
So you get the idea. Of course you can simply skip the $filter part and simply get list of all set names and cache them somewhere.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With