Parametric Filter execution example - Intergraph Smart API Manager - 5.0 - Help

Intergraph Smart API Manager Help

Language
English
Product
Intergraph Smart API Manager
Search by Category
Help
Smart API Manager Version
5.0

Smart APIs provide an OData action and corresponding OData function to manage executing parametric filters:

  • Execute{FilterTypeName} - call this OData action to execute a parametric filter.

  • GetExecute{FilterTypeName}ResultAsync - call this OData function to monitor parametric filter execution (relevant only if the execute action is called asynchronously).

where {FilterTypeName} is the name for a parametric filter.

Here are some sample URLs you can use to execute/monitor parametric filters defined for the SampleService:

OData actions are called with HTTP POST. In the SampleService, there is a single parametric filter named "ParametricFilter", so the action name is ExecuteParametricFilter.

POST https://sam.spclouddave.com/SampleService/Sppid/V2/Plants('Plant A')/Filters('1582')/Com.Ingr.Sppid.V1.ExecuteParametricFilter

If you examine the metadata document for the SampleService, you will notice there are multiple input parameters for ExecuteParametricFilter.

https://sam.spclouddave.com/SampleService/Sppid/V2/$metadata

<Action Name="ExecuteParametricFilter" IsBound="true">

<Parameter Name="bindingParameter" Type="Com.Ingr.Sppid.V1.ParametricFilter" Nullable="false" />

<Parameter Name="objectHierarchy" Type="Com.Ingr.Core.V1.ObjectHierarchy" />

<Parameter Name="objectTypes" Type="Collection(Edm.String)" />

<Parameter Name="queryExpression" Type="Edm.String" />

<ReturnType Type="Collection(Com.Ingr.Sppid.V1.Equipment)" />

</Action>

You can pass the input parameters in the body of the request as a JSON array:

{

"objectHierarchy": {

"Name" : "PBS",

"ResourceIds" : ["Plants('Plant A')/Areas('Area A')/Units('Unit A')/Vessels('8')"]

},

"objectTypes" : ["Com.Ingr.Sppid.V1.Nozzle"],

"queryExpression" : "$filter=Status eq 'Active'&$select=Id,Name,Status&$orderby=Id desc&$count=true"

}

In this example, the response will return Nozzles related to Vessels('8') with a Status equal to "Active", limited to three property names, sorted and with a count.

GET https://sam.spclouddave.com/SampleService/Sppid/V2/Plants('Plant A')/Filters('1582')/Com.Ingr.Sppid.V1.GetExecuteParametricFilterResultAsync(resultId='4a7dbefd-663e-496f-829e-905a9e2e2eb0')

The URI to get the parametric filter result shown is an example. The URI represents a status monitor resource returned as an HTTP Location header in the response, when ExecuteParametricFilter is called asynchronously. See Asynchronous support for full details.