Samples of how to work with existing subscriptions via API
-
Hi,
instead of creating and deleting complete subscriptions after you added or deleted devices you can add or remove the device to or from from the existing subscription.
In the following the Nokia IMPACT API samples
- to get the devices of an existing subscription,
- list itemto add a devices to an existing subscription,
- list itemto delete a devices from an existing subscription (important: if the last device of a subscription is delete the subscription it-self is deleted as well).
Get devices of an existing subscription
GET https://iot.netwerk.t-mobile.nl:443/m2m/subscriptions/f37b094d-307f-4d43-82c5-73f81104e22f/serialNumbers HEADERS: { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Basic QVBJX0NPTsl8wMDssAswMDAbxNcTU4XzNlZmEzOkpySS9YOC45Y19CrrRmI0OEY=" } BODY: { "serialNumbers": [ "IMEI:452749630137052", "IMEI:351938100191440" ] } RETURN STATUS CODE: 200 RETURN BODY: { "serialNumbers": [ "IMEI:454596441983713", "IMEI:351938100191440", "IMEI:866425033313638", "IMEI:452749630137052", "IMEI:352656100979544" ] }
Add devices to an existing subscription
POST https://iot.netwerk.t-mobile.nl:443/m2m/subscriptions/f37b094d-307f-4d43-82c5-73f81104e22f/serialNumbers HEADERS: { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Basic QVBJsX0NPTl8wMDsssswMDAbxNcTU4XzNlZmEzOkpySS9YOfgC45Y19CRmI0OEY=" } BODY: { "serialNumbers": [ "IMEI:452749630137052", "IMEI:351938100191440" ] } RETURN STATUS CODE: 200 RETURN BODY: { "subscriptionId": "f37b094d-307f-4d43-82c5-73f81104e22f", "msg": "Success", "code": 1000 }
Delete devices from an existing subscription
DELETE https://iot.netwerk.t-mobile.nl:443/m2m/subscriptions/f37b094d-307f-4d43-82c5-73f81104e22f/serialNumbers HEADERS: { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Basic QVBJsX0NPTl8wcMDssAwMDAbxNabcTU4XzNlZmEzOkpySS9YOC45Y19CRmI0OEY=" } BODY: { "serialNumbers": [ "IMEI:452749630137052", "IMEI:351938100191440" ] } RETURN STATUS CODE: 200 RETURN BODY: { "subscriptionId": "f37b094d-307f-4d43-82c5-73f81104e22f", "msg": "Success", "code": 1000 }