Web API: Expression: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 9: | Line 9: | ||
* '''Expression''' (string): Expression to run. | * '''Expression''' (string): Expression to run. | ||
* '''SessionName''' (string): Identifying name for the calculation session. | * '''SessionName''' (string): Identifying name for the calculation session. | ||
* '''ContextType''' (string): Same as in [[Web_API:_Expression/query#Properties/api/expression/query | * '''ContextType''' (string): Same as in [[Web_API:_Expression/query#Properties|/api/expression/query]]. | ||
* '''ModelId''' (integer): Same as in [[Web_API:_Expression/query#Properties/api/expression/query | * '''ModelId''' (integer): Same as in [[Web_API:_Expression/query#Properties|/api/expression/query]]. | ||
* '''FilterId''' (integer): Same as in [[Web_API:_Expression/query#Properties/api/expression/query | * '''FilterId''' (integer): Same as in [[Web_API:_Expression/query#Properties|/api/expression/query]]. | ||
* '''QueryIdentifier''' (string): Same as in [[Web_API:_Expression/query#Properties/api/expression/query | * '''QueryIdentifier''' (string): Same as in [[Web_API:_Expression/query#Properties|/api/expression/query]]. | ||
* '''CancelEarlierQueriesWithIdentifier''' (boolean): Same as in [[Web_API:_Expression/query#Properties/api/expression/query | * '''CancelEarlierQueriesWithIdentifier''' (boolean): Same as in [[Web_API:_Expression/query#Properties|/api/expression/query]]. | ||
== Example == | == Example == |
Revision as of 17:48, 10 October 2021
Expression method runs the given expression and returns the result of the calculated expression formatted as json. Each run is stored to a calculation session, and the same session can be continued in the next expression run. This way, for example initialized variables are available in the next run. Calculatation sessions are maintained in the server memory and dropper latest after 10 minutes if not used.
Url: POST /api/expression Content-Type: application/json;charset=UTF-8 Body: (json object with parameters defined below)
Following parameters can be used in the request body:
- Expression (string): Expression to run.
- SessionName (string): Identifying name for the calculation session.
- ContextType (string): Same as in /api/expression/query.
- ModelId (integer): Same as in /api/expression/query.
- FilterId (integer): Same as in /api/expression/query.
- QueryIdentifier (string): Same as in /api/expression/query.
- CancelEarlierQueriesWithIdentifier (boolean): Same as in /api/expression/query.
Example
This example runs an expression in the Model context and show model id and name. It also assumes that there is a variable variable1 available in the calculation session.
{ "contextType": "Model", "expression": "`${variable1}: ${Id}: ${Name}`", "sessionName": "UserSession1", "modelId": 123 }