Comcast / Comcast/rulio

Rule with dynamic parameter

Open
#48 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
337
Forks
58
PR merge metrics
No merged PRs in 30d

Description

This is my rule
```
{
"location": "here",
"rule": {
"action": {
"code": "var msg ='Name :' + who + ' age : '+x; console.log(msg); msg;"
},
"condition": {
"and": [
{
"pattern": {
"age": "?x",
"name": "?who"
}
},
{
"code": "x >6"
}
]
},
"when": {
"pattern": {
"age": "?x",
"name": "?who"
}
}
}
}
```
In the above JSON, I am checking with constant 6 where age> 6 in my condition, but is there a way where I can pass a variable instead of fix values from the uri: /api/loc/events/ingest
For example
uri: /api/loc/events/ingest
request
```
{
"location": "here",
"event": {
"age": "8",
"name": "sonu"
}
}
```
The age passed here i.e. 8 should be used in the rule condition and the result should be according to that?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.