Is there a way to obtain the Device ID from the Device Name?

There is a topic some 2.5 years old that does not appear to have been answered.

For a device setup function within a web device management app I would like to use the device name (a user friendlier way) to access (via the cloud API) the device ID of an already claimed device. At present all the functions are keyed off the device ID (because it is unique) - is there any way to get the device ID from the device name for devices claimed under one account? I could use Particle List but this will return a lot of information I don’t want. Are there any switches on Particle List that are not documented that would filter for just the device name and device ID?

For example

$ Particle List - switch

[devicename1] 12345678901234567890ABCD
[devicename2] 12345678901234567890ABCE
[devicename3] 12345678901234567890ABCF

I’m not aware of any, but you could easily process the output to filter the result list :wink:
You could also use the cloud API without CLI
and process that response

Or the JS library with node.js :wink:

1 Like

Of course, you could also slightly modify the CLI to give you what you need…
In the cloudcommands.js file, make the changes below :wink:

Neat idea - I really need to do this from http URL - i.e. the cloud API and not from the CLI - sorry I rather mixed up the example. I am guessing that the Particle API JS (Javascript) could be modified in the same way. Is cloudcommands.js on github?