The Storage Integration is implemented as an Application Package.
Note:
Enabling/disabling Storage Integration for applications can be done using The Things Stack Console or CLI. Enabling/disabling Storage Integration for individual end devices is available only via CLI.
Note that the instructions for CLI here are following generic instructions for using the CLI to manage application packages, just specified for the storage-integration
application package.
Note:
It’s currently only possible to enable/disable storage integration for an application via the Console. To do this for end devices, use the CLI or API option.Enable for an Application
Navigate to Applications in the top menu and then select your application. On the left side, click Integrations and then Storage Integration.
Click on Activate Storage Integration to enable the storage integration for your application.
Disable for an Application
To disable the integration, you only need to click the Deactivate Storage Integration button:
Enable for an Application
Set up a default association between the desired application and the storage-integration
package.
ttn-lw-cli applications packages default-associations set <application-id> <f_port> --package-name storage-integration
Note:
Thef_port
for the default association is set to 100
. This value is irrelevant, i.e. the storage integration will receive and store all uplink messages, regardless of f_port
. The f_port
value is only needed because of the way application packages work with The Things Stack.
Warning:
Do not configure more than one default association for the same application, since that will lead to storing duplicate messages in the persistent storage.Enable for an End Device
Set up an association between the desired end device and the storage-integration
package.
ttn-lw-cli applications packages associations set <application-id> <device-id> <f_port> --package-name storage-integration
Disable for Application
To disable the integration, delete the package association or the default association.
To list associations:
ttn-lw-cli applications packages default-associations list $APP_ID
The output will be something like:
{
"defaults": [
{
"ids": {
"application_ids": {
"application_id": "app1"
},
"f_port": 100
},
"created_at": "2020-08-24T21:09:44.649890166Z",
"updated_at": "2020-08-24T21:09:44.649890166Z",
"package_name": "storage-integration"
}
]
}
Then delete the association with:
ttn-lw-cli applications packages default-associations delete <application-id> <f_port>
Disable for End Device
To disable the integration, delete the association.
To list associations:
ttn-lw-cli applications packages associations list $APP_ID $DEVICE_ID
The output will be something like:
{
"associations": [
{
"ids": {
"end_device_ids": {
"device_id": "dev1",
"application_ids": {
"application_id": "app1"
}
},
"f_port": 100
},
"created_at": "2020-08-24T21:09:44.649890166Z",
"updated_at": "2020-08-24T21:09:44.649890166Z",
"package_name": "storage-integration"
}
]
}
Delete the association with:
ttn-lw-cli applications packages associations delete <application-id> <device-id> <f_port>
Enable for an Application
Details
Item | Value |
---|---|
Endpoint | /api/v3/as/applications/{default.ids.application_ids.application_id}/packages/associations/{default.ids.f_port} |
Request type | PUT |
Example
To set an association for the application my-test-app
on the FPORT 100
on thethings.example.com
, first create a JSON file named req.json
in the same folder with the following example contents.
{
"default": {
"package_name": "storage-integration"
},
"field_mask": {
"paths": ["package_name"]
}
}
The request using cURL
is as follows.
curl -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer $API_KEY" \
-d @./req.json \
https://thethings.example.com/api/v3/as/applications/my-test-app/packages/associations/100
{"ids":{"application_ids":{"application_id":"my-test-app"},"f_port":100},"created_at":"2024-01-10T10:59:21.398555Z","updated_at":"2024-01-10T10:59:21.398555Z","package_name":"storage-integration"}%
Enable for an End Device
Details
Example
To set an association for the device my-test-dev
in the application my-test-app
with FPORT 100
on thethings.example.com
, first create a JSON file named req.json
in the same folder with the following example contents.
{
"association": {
"package_name": "storage-integration"
},
"field_mask": {
"paths": ["package_name"]
}
}
The request using cURL
is as follows.
curl -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer $API_KEY" \
-d @./req.json \
https://thethings.example.com/api/v3/as/applications/my-test-app/devices/my-test-dev/packages/associations/100
{"ids":{"end_device_ids":{"device_id":"my-test-dev","application_ids":{"application_id":"my-test-app"}},"f_port":100},"created_at":"2024-01-10T11:06:46.806972Z","updated_at":"2024-01-10T11:06:46.806972Z","package_name":"storage-integration"}
Disable for an Application
Details
Item | Value |
---|---|
Endpoint | /api/v3/as/applications/{application_ids.application_id}/packages/associations/{f_port} |
Request type | DELETE |
Example
To delete an association the application my-test-app
with FPORT 100
on thethings.example.com
, run the following request.
curl -X DELETE -H "Content-Type: application/json" -H "Authorization: Bearer $API_KEY" \
-d @./req.json \
https://thethings.example.com/api/v3/as/applications/my-test-app/packages/associations/100
{}
Disable for an End Device
Details
Item | Value |
---|---|
Endpoint | /api/v3/as/applications/{end_device_ids.application_ids.application_id}/devices/{end_device_ids.device_id}/packages/associations/{f_port} |
Request type | DELETE |
Example
To delete an association for the device my-test-device
on the application my-test-app
with FPORT 100
on thethings.example.com
, run the following request.
curl -X DELETE -H "Content-Type: application/json" -H "Authorization: Bearer $API_KEY" \
-d @./req.json \
https://thethings.example.com/api/v3/as/applications/my-test-app/devices/my-test-device/packages/associations/100
{}