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?
Well, if you want the entities list, you can simply query and parser the root of the service like this:
If you want the fields too, you can do this:
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:
result is the following:
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.1.To get all the entities available in your crm:
2.To get all the records metadata information (Retrieve Multiple Records):
3.To get the specific record email address information (Retrieve Single Record). What ever we chose the attributes in the select clause, we can get those attributes information in the result:
4.To get entire metadata information in the CRM:
Another approach would be to generate the plural name from the singular name.
As far as I understand, the rules to pluralize entity names in the Web API v8+ are:
Here is a JavaScript function that I use for this: