Use the Web API with Dynamics 365 metadata
Applies To: Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online
You can perform any of the metadata operations with the Web API that you can perform using the organization service. This section provides guidance about how to use the Web API with the entity types included in Web API Metadata EntityType Reference.
There are four entity set paths exposed to perform operations with metadata entities as described in the following table.
Entity Set Path |
Description |
---|---|
[Organization URI]/api/data/v8.2/EntityDefinitions |
Contains EntityMetadata EntityType entities. |
[Organization URI]/api/data/v8.2/RelationshipDefinitions |
Contains ManyToManyRelationshipMetadata EntityType and OneToManyRelationshipMetadata EntityType as both inherit from RelationshipMetadataBase EntityType. |
[Organization URI]/api/data/v8.2/GlobalOptionSetDefinitions |
Contains globally defined BooleanOptionSetMetadata EntityType and OptionSetMetadata EntityType entities as both inherit from OptionSetMetadataBase EntityType. |
[Organization URI]/api/data/v8.2/ManagedPropertyDefinitions |
For internal use only. |
Each metadata entity type uses MetadataId as the unique identifier property, which it inherits from the MetadataBase EntityType. While all metadata entities have a MetadataId, you can’t query all of them directly. For example, you can query and perform operations on attributes only in the context of the EntityMetadata entity that contains them.
These entities have some substantial differences from the entities that store business and application data, for example:
The properties for metadata entities use many of the complex and enum types defined in Web API ComplexType Reference and Web API EnumType Reference rather than the primitive data types used for properties in entities that inherit from crmbaseentity EntityType.
Metadata entities follow a different naming convention and maintain the Pascal Case naming style used in the assemblies of the organization service.
Metadata entities make more extensive use of inheritance, which requires that you may need to perform casts to retrieve the data that you want.
In This Section
Query metadata using the Web API
You can use the Web API to query metadata in a manner similar to what can be done using the RetrieveMetadataChangesRequest and the objects in the Microsoft.Xrm.Sdk.Metadata.Query namespace using the organization service.Retrieve metadata by name or MetadataId
Your applications can adapt to configuration changes by querying the metadata. When you know one of the key properties of a metadata item, you can retrieve metadata definitions using the Web API.Create and update entity definitions using the Web API
You can create and update entities and attributes using the Web API to achieve the same results you get with the organization service CreateEntityRequest, UpdateEntityRequest, CreateAttributeRequest, and UpdateAttributeRequest.Create and update entity relationships using the Web API
You can check whether entities are eligible to participate in a relationship with other entities and then create or update those relationships using the Web API.
See Also
The metadata and data models in Microsoft Dynamics 365
Browse the metadata for your organization
Use the Organization service with Dynamics 365 metadata
Use the Microsoft Dynamics 365 Web API
Microsoft Dynamics 365
© 2016 Microsoft. All rights reserved. Copyright