Nokia logo
DocumentationBlogPricing
Request access

Getting a Device-Status subscription

Getting a subscription by its name (ID)

Here, we will show how to get a specific subscription using the client.connectivity.get_subscription() method.

If you previously created a Device-Status subscription or if there are multiple ones and you need to modify or delete a specific one, you can easily retrieve it with its unique subscription name (ID) or with a device identifier instead. In this case, it needs to be the device's phone number.

import network_as_code as nac
 
from network_as_code.models.device import Device, DeviceIpv4Addr
 
client = nac.NetworkAsCodeClient(...)
 
subscription = client.connectivity.subscribe(...)
 
# Use the device phone number to retrieve its subscription:
device = client.devices.get(phone_number="36721601234567")

Alternatively, use the subscription name (ID) if you have it, which is a string value:

subscription = client.connectivity.get_subscription("subscription-name_1")

Note that the snippet above assumes you have already created Device Status subscription before, which you can learn how to do here. And that you have also created a Network-as-Code client and identified your mobile network device previously.

Last updated on December 04, 2023

On this page
Getting a subscription by its name (ID)