Stellio Get Subscriptions
The node sends a GET request to the subscription endpoint of the Stellio context broker and returns all subscriptions of the tenant as an array. It is deliberately simple and suits verification and logging flows.
- Node type
- stellio-get-subscriptions
- Package
- @htag/node-red-contrib-hypertegrity-ngsi-ld
- Inputs / outputs
- 1 / 1
- Target
- Stellio context broker (NGSI-LD)
When to use this node
If you only want to know which subscriptions exist in a tenant, this node is sufficient. It needs only tenant and API URL and returns the broker response unchanged. To read single subscriptions or to activate and deactivate them, use Stellio Subscriptions.
Typical use cases are:
- Regular check: fetch the subscriptions daily via an Inject node and compare them with a target list.
- Look up an id: find the id of a subscription to pass it to Stellio Delete Subscription.
- Documentation: write the current state of the subscriptions to a log or a file.
How the node works
Trigger
Any incoming message starts the fetch.
Send GET
The node calls /ngsi-ld/v1/subscriptions/?limit=<limit> with the NGSILD-Tenant header.
Emit response
The subscription array, the status code and the headers are written into the message.
Result: An array of all subscriptions of the tenant in msg.payload.
The node is message-driven and sends exactly one request per incoming message. Combine it with an Inject node if you need the list regularly.
Configuration
| Field | Type | Default | Meaning |
|---|---|---|---|
| Name | Text | empty | Display name of the node in the flow. Without a name the node shows the tenant. |
| NGSILD-Tenant | Text (required) | empty | Value of the NGSILD-Tenant header, for example default_dataspace. |
| API URL | Text | empty | Base URL of the broker. If the field is empty, the node uses the environment variable STELLIO_API_URL. A placeholder ${STELLIO_API_URL} is replaced by Node-RED. |
| Limit | Number | 100 | Maximum number of returned subscriptions. |
Input
| Property | Type | Meaning |
|---|---|---|
msg.tenant | string | Overrides the configured tenant. |
msg.apiUrl | string | Overrides the configured API URL. |
msg.limit | number | Overrides the configured limit. |
msg.payload | any | Not evaluated; the message only acts as trigger. |
Output
[
{
"id": "urn:ngsi-ld:Subscription:7f3a2c1e-0000-4000-8000-000000000001",
"type": "Subscription",
"subscriptionName": "Subscription for entity type WeatherObserved.",
"entities": [{"type": "https://smartdatamodels.org/dataModel.Weather/WeatherObserved"}],
"watchedAttributes": ["https://smartdatamodels.org/dateObserved"],
"isActive": true,
"notification": {
"format": "normalized",
"endpoint": {"uri": "https://quantumleap.exampletown.example/v2/notify", "accept": "application/json"}
}
}
]
| Field | Meaning |
|---|---|
msg.payload | Array of subscription objects as delivered by the broker. Because the node sends no Link header, type and attribute names may appear as full URIs. If the response is not valid JSON, the payload holds the raw text. |
msg.statusCode | HTTP status code of the response. |
msg.headers | Response headers of the broker. |
Example flow
The package ships with a shared example flow for several Stellio nodes. Import it in Node-RED via Menu → Import → Examples → @htag/node-red-contrib-hypertegrity-ngsi-ld → stellio-helper-nodes. Alternatively download stellio-helper-nodes.json and import it via Menu → Import.
Inject
An Inject node triggers the fetch manually or at a fixed interval.
Get Subscriptions
The node fetches up to 100 subscriptions of the tenant default_dataspace.
Debug
A Debug node shows the subscription array in the sidebar.
Show example flow as JSON (Get Subscriptions excerpt)
[
{"id": "tab1", "type": "tab", "label": "Stellio Helper Nodes", "disabled": false, "info": ""},
{"id": "inject1", "type": "inject", "z": "tab1", "name": "", "props": [{"p": "payload"}], "repeat": "", "once": false, "payload": "", "payloadType": "date", "x": 100, "y": 100, "wires": [["get1"]]},
{"id": "get1", "type": "stellio-get-subscriptions", "z": "tab1", "name": "Get Subscriptions", "tenant": "default_dataspace", "apiUrl": "", "limit": 100, "x": 290, "y": 100, "wires": [["debug1"]]},
{"id": "debug1", "type": "debug", "z": "tab1", "name": "Subscriptions", "active": true, "tosidebar": true, "complete": "false", "x": 530, "y": 100, "wires": []}
]
Status and errors
| Indicator | Meaning |
|---|---|
| Blue dot "requesting..." | The request is running. |
| Green dot "status: 200" | Fetch successful. |
| Yellow ring "status: 404" (or another status code) | The broker answered with an error status. The message is still sent. |
| Red ring "parse error" | The response is not valid JSON. The message is sent with the raw text in msg.payload. |
| Red ring "error" with error message | Network error, for example broker unreachable or invalid URL. No message is sent. |
Errors are reported via node.error and can be handled with a Catch node.
Notes
- No Link header: The node sends no JSON-LD context. For short attribute names in the response, use Stellio Subscriptions with a configured context.
- Authentication: The node sends no authentication headers; access to the broker is protected by the network or an upstream gateway.
- Personal data: Subscription lists contain notification URLs. Check whether these must remain internal before passing on the output.