Our requirement is all device data(name, id and external id ) in one API.
Currently one API is Available for get external id on the basis of device ID. this is more complex suppose I have 1000 device. This device is showing in drop down menu that case 1000 times external id API will be call. But our requirement is different, external id should be one object with device details.
Please give me solution it will be help for us. Thanks in advance
for showing devices in a dropdown box you don’t need to call the identity api. You mainly use queries for managed objects. Identity API is called when single objects should be retrieved/updated etc. If you just want to display the identifier there are multiple ways to achieve that. Easiest way is to add the identifier to the device name.
You can also store identifiers as part of the managed object by adding a custom fragment e.g. “my_extId”. There are not checks performed for uniqueness etc.
When now retrieving the devices you can use the inventory API with a query to filter specific devices (if desired).
Do you have like any example of the mangagedObjects query API? I did’t get the storing the external ID of the device in the device mangedObjects.
I do have the same use case, I have built a custom widget where in the configuration i’m providing user to select the device from the drop down, but many devices have the same name so i thought to concat the external ID with the name for uniqueness.
To get the list of device i use something like this:
you are on the wrong end (UI). You should do this on device registration/data ingestion.The name should be provided by the device agent so it contains already the external id.
Once stored “wrongly” you cannot much do about but just finding some hacks to query the identity api etc. to also display the external id.
Btw. you can also rename you device manually by adding the external id afterwards. For 1000s of devices a script could do that but normally this is the task of the agent to send a meaningful name (containing an unique identifier).