While annotations for structured properties such as DisplayName, SelectListId, and UnitCategory annotations are available in the metadata document, the corresponding annotations for dynamic properties are only available through instance annotations.
Include the following system query options to view instance annotations for dynamic properties in the response:
$format=application/json;odata.metadata=full
Instance annotation logic also relies on the Prefer header with the appropriate odata.include-annotations value to specify the annotation data that should be returned. The table below shows examples and the OData protocol.
odata.include-annotations Value |
Effect |
---|---|
* |
Includes all annotations |
Com.Ingr.* |
Includes all annotations in the Com.Ingr namespace |
Com.Ingr.Core.V1.DisplayName |
Includes only DisplayName annotations |
Example
Take the case where the result includes a dynamic property named HSLengthSiValue with a value of 0.9. Based off the name and value you notice that this is an UOM property, but you need more information such as the display name and unit category to properly show the data to the client.
To get more data in the form of instance annotations you make the following request:
GET
MyPreviousURL?$format=application/json;odata.metadata=full
HEADERS
Prefer:odata.include-annotations="Com.Ingr.Measures.V1.UnitCategory,Com.Ingr.Core.V1.DisplayName"
And you would receive the following additional data about HSLengthSiValue in your response:
"HSLengthSiValue@Com.Ingr.Core.V1.DisplayName": "[HSL] - Head Section Length",
"HSLengthSiValue@Com.Ingr.Measures.V1.UnitCategory": "Length"