NGSI Go tutorial for Perseo

Get settings of alias

ngsi server get --host perseo
serverType perseo
serverHost http://perseo:9090
ngsi version --host perseo --pretty
{
  "error": null,
  "data": {
    "name": "perseo",
    "description": "IOT CEP front End",
    "version": "1.12.1"
  }
}

List rules

ngsi rules list --verbose --pretty

```json
[]

Create rules

ngsi rules --host perseo create \
--data '{
    "name": "blood_rule_update",
    "text": "select *, *, ev.BloodPressure? as Pressure, ev.id? as Meter from pattern [every ev=iotEvent(cast(cast(BloodPressure?,String),float)>1.5 and type=\"BloodMeter\")]",
    "action": {
        "type": "update",
        "parameters": {
            "attributes": [
                {
                    "name": "abnormal",
                    "value": "true",
                    "type": "boolean"
                }
            ]
        }
    }
}'

List rules

ngsi rules list
blood_rule_update

Get rule

ngsi rules get --name blood_rule_update --pretty
{
  "error": null,
  "data": {
    "_id": "6024c00a8e2bfc0012c77486",
    "name": "blood_rule_update",
    "text": "select \"blood_rule_update\" as ruleName, *, *, ev.BloodPressure? as Pressure, ev.id? as Meter from pattern [every ev=iotEvent(cast(cast(BloodPressure?,String),float)>1.5 and type=\"BloodMeter\")]",
    "action": {
      "type": "update",
      "parameters": {
        "attributes": [
          {
            "name": "abnormal",
            "value": "true",
            "type": "boolean"
          }
        ]
      }
    },
    "subservice": "/",
    "service": "unknownt"
  }
}

Delete rule

ngsi rules delete --name blood_rule_update
ngsi rules list --count
0