Upgrade Delegation
The upgrade delegation feature allows one subscriber to manage the device upgrades of another subscriber. This guide covers the delegation model, the permissions it grants, and the API endpoints used to create, view, edit, and delete delegation records.
Before You Begin
You need:
- The subscriber ID of the subscriber you want to delegate to (
delegate_to). - The DevEUI patterns of the devices you want to allow the other subscriber to manage.
$MQ_TOKENexported from the authentication step. See Quick Start Guide.
Use Cases
- Subscriber A owns devices and gateways on their account, but some of Subscriber A's devices are manufactured and managed by Subscriber B. Subscriber B needs to update those devices.
- Subscriber A owns the gateways while Subscribers B, C, and D bring their own solutions to a site with Subscriber A's gateways. Each subscriber updates the devices they provisioned, and Subscriber A allows them to use their gateway for upgrades.
Warning: Gateway delegation is not supported yet. The second use case, where Subscriber A allows other subscribers to use their gateways, has not been implemented. If you would benefit from this feature, please contact Product and/or your Sales representative.
Glossary
delegate_from— The subscriber who lets another subscriber (delegate_to) manage its device upgrades and/or use their gateways for upgrades.delegate_to— The subscriber who can manage other subscribers' device upgrades according to the delegation records.
Assumptions
delegate_fromdoes not want to manage firmware upgrades for an external vendor or create vendor MQcentral accounts.delegate_tocannot mix devices from differentdelegate_fromsubscribers (including mixing with their own devices).delegate_fromdoes not need to see the resources created bydelegate_tothat include their devices (device groups, campaigns, reliable downlink jobs, etc.).- There can be only one record from
delegate_fromtodelegate_to. To change it, use aPATCHrequest to update the record.
Delegation Record Data Model
| Field | Description |
|---|---|
delegate_from |
The subscriber ID who delegated upgrade management. |
delegate_to |
The subscriber ID who can manage the delegate_from subscriber's device upgrades. |
include_devices |
List of DevEUI patterns that can be used by the delegate_to subscriber. |
exclude_devices |
List of DevEUI patterns, applied after include_devices, removing devices from the allowed list. |
include_gateways |
List of NodeID patterns that can be used by delegate_to. Currently not implemented. |
exclude_gateways |
List of NodeID patterns, applied after include_gateways. Currently not implemented. |
created_at |
When the record was created. |
expires_at |
When the record becomes inactive. After this date the server will not allow delegate_to any of the allowed actions. |
Permissions
When delegate_from delegates device upgrade management to delegate_to, delegate_to can:
- Create device groups with
delegate_fromdevices. - Add
delegate_fromdevices to a device group and patch device groups withdelegate_fromdevices. - Create reliable downlink jobs with
delegate_fromdevices. - See the device versions of
delegate_from(only the delegated devices). The device version API accepts an optionaldelegated_subscriber_idquery parameter; when provided, the result includes all DevEUIs belonging todelegated_subscriber_idafter applying theinclude_devicesandexclude_devicesfilters. - Run FUOTA campaigns for device groups with
delegate_fromdevices.
Note:
delegate_fromdevices are any devices that pass theinclude_devicesandexclude_devicesfilter and belong to thedelegate_fromsubscriber.
Important: The
delegate_tosubscriber cannot specify the gateways in a device group with delegated devices. The FUOTA server automatically chooses the best gateway for the delegated devices. See the Automatic Gateway Selection section below.
Managing Delegations
There are multiple Upgrade Delegation APIs to manage the records.
Create Delegation
To create the upgrade delegation, use a POST request with the following payload.
curl -sS -X POST "https://fuota.machineq.net/api/v3.2/upgrade_delegation" \
-H "Authorization: Bearer $MQ_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"delegate_to": "mq61lp",
"include_devices": ["2CC407..00000FF."],
"exclude_devices": ["2CC407..00000FF1"],
"expires_at": "2100-12-31T23:59:59Z"
}' | jq
delegate_to— The subscriber ID to whom you delegate upgrading devices on your subscriber.include_devices— A list of DevEUI patterns formatted like the version pattern. Each must be 16 characters, using only hex characters and.(the dot matches any character).exclude_devices— Uses the same format asinclude_devicesbut filters out any matching DevEUIs from the allowed list. It is applied afterinclude_devices.expires_at— When the delegation record expires. After this date,delegate_tocannot perform the allowed actions.
Example: Suppose the current subscriber has five devices:
2CC4073100000FF5,2CC4073300000FF1,2CC4073500000FF1,2CC4073300000FF2, and2CC4079B00000FA8. Using the payload above,delegate_tomay manage upgrades of2CC4073100000FF5and2CC4073300000FF2. Devices2CC4073300000FF1and2CC4073500000FF1matchexclude_devices, while2CC4079B00000FA8does not matchinclude_devices.
Note: The delegation record is visible to both
delegate_fromanddelegate_to, but onlydelegate_fromcan edit and delete it.
Get Delegations
List all delegation records using the List Upgrade Delegations API, or retrieve a specific record using the Get Upgrade Delegation API.
Edit Delegation
Edit a record using the Update Upgrade Delegation API. All fields are the same as the POST request, but all are optional; only the included fields are edited.
Note: When a record's
include_devices/exclude_deviceschanges, any device groups, campaigns, and reliable downlink jobs containing devices that no longer match will continue to exist. However, any action on those resources except deletion is prohibited. For example,delegate_tocannot start or restart a campaign that contains DevEUIs no longer matching the new filters.
Delete Delegation
Delete a record using the Delete Upgrade Delegation API.
Note: When you delete a record, the existing resources with delegated devices continue to exist, but any action on them except deletion is prohibited. Only the subscriber who created the delegation record can edit and delete it.
Automatic Gateway Selection
When the campaign starts, the server performs an additional check for the devices in the current device group. It first looks at all the gateways the target devices can reach, then partitions the gateways by subscriber and chooses the group of gateways belonging to a single subscriber based on the total "score" of that group. The score is usually equivalent to the number of devices the gateways can upgrade and the connection quality to those devices. The algorithm can choose the gateway group belonging to delegate_from or delegate_to, but not both.
Note: The Managed Campaigns feature does not support upgrade delegation yet.
What's Next?
- Multicast Key Management: See how centralized keys support delegated upgrades.
- Gateway Selection: Learn how gateways are automatically chosen for delegated devices.
- Firmware Version Parsing: Understand the pattern format used for DevEUI filters.