The sample Smart API shown in this section supports a non-derived entity scheme, based on the Org.OData.Core.V1.MayImplement annotation. The following $metadata shows that instances of Com.Ingr.SampleApi.V1.Pipe may be cast to Com.Ingr.SampleApi.V1.CatalogItem and in reverse.
Typically, a client appends a type-cast URL segment to limit response data (based on a derived type). For example, to limit a query for PlantItems to Pipes:
The approach is identical to that shown above in Typecast derived types.
The following steps provide an overview:
After you connect to a Smart API, the Navigator dialog box shows all available OData entity sets.
Select an entity set that supports casting to a non-derived type and click Transform Data to load the Power Query Editor.
Certain Smart APIs use the multi-tenant pattern that exposes a single entity set at the service root, for example, Sites. In this case, you must navigate to the desired entity set after selecting and loading the single entity set.
You must be familiar with the MayImplement annotations for entities in the Smart API. See the specific Smart API annotations/$metadata document or API documentation for details.
In this example, the Sites/Plants/Pipes entity set is used.
Click the View tab, and then Advanced Editor. The editor displays something similar to the following:
The query for the Sites/Plants/Pipes navigation property collection stores the result in #"E63F816D-B7E7-4FC9-AE62-7E709AFF290E".
Modify the code in the Advanced Editor to typecast that result to catalog items using the SmartApiOData.Typecast function.
Click Done. The table updates to display CatalogItems data.