Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Doc] Add geofencing subscription example #4431

Merged
merged 4 commits into from
Nov 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 34 additions & 4 deletions doc/manuals/orion-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -3651,7 +3651,7 @@ A `condition` contains the following subfields:
| Parameter | Optional | Type | Description |
|--------------|----------|-------|-------------------------------------------------------------------------------------------------------------------------------|
| `attrs` | ✓ | array | Array of attribute names that will trigger the notification. Empty list is not allowed. |
| `expression` | ✓ | object| An expression composed of `q`, `mq`, `georel`, `geometry` and `coords` (see [List Entities](#list-entities-get-v2entities) operation above about this field). `expression` and sub elements (i.e. `q`) must have content, i.e. `{}` or `""` is not allowed |
| `expression` | ✓ | object| An expression composed of `q`, `mq`, `georel`, `geometry` and `coords` (see [List Entities](#list-entities-get-v2entities) operation above about this field). `expression` and sub elements (i.e. `q`) must have content, i.e. `{}` or `""` is not allowed. `georel`, `geometry` and `coords` have to be used together (i.e. "all or nothing"). Check the example using geoquery as expression [below](#create-subscription-post-v2subscriptions).|
| `alterationTypes` | ✓ | array | Specify under which alterations (entity creation, entity modification, etc.) the subscription is triggered (see section [Subscriptions based in alteration type](#subscriptions-based-in-alteration-type)) |
| `notifyOnMetadataChange` | ✓ | boolean | If `true` then metadata is considered part of the value of the attribute in the context of notification, so if the value doesn't change but the metadata changes, then a notification is triggered. If `false` then the metadata is not considered part of the value of the attribute in the context of notification, so if the value doesn't change but the metadata changes, then a notification is not triggered. Default value is `true`. |

Expand Down Expand Up @@ -3862,7 +3862,7 @@ _**Request payload**_
The payload is a JSON object containing a subscription that follows the JSON subscription representation
format (described in ["Subscription payload datamodel](#subscription-payload-datamodel) section).

Example:
Example using attribute filter:

```json
{
Expand All @@ -3887,8 +3887,38 @@ Example:
},
"attrs": ["temperature", "humidity"]
},
"expires": "2025-04-05T14:00:00.00Z",
"throttling": 5
"expires": "2025-04-05T14:00:00.00Z"
}
```

Example using geoquery as condition:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

L3865 should be changed to "Example using attribute filter".

Copy link
Collaborator Author

@mapedraza mapedraza Nov 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done at e56a7be


```json
{
"description": "One subscription to rule them all",
"subject": {
"entities": [
{
"idPattern": ".*",
"type": "Room"
}
],
"condition": {
"attrs": [ "temperature" ],
"expression": {
"georel": "near;maxDistance:15000",
"geometry": "point",
"coords": "37.407804,-6.004552"
}
}
},
"notification": {
"http": {
"url": "http://localhost:1234"
},
"attrs": ["temperature", "humidity"]
},
"expires": "2025-04-05T14:00:00.00Z"
}
```

Expand Down
Loading