# Getting Internal ID from from Device Agent using Mqtt client connection

**URL:** https://community.cumulocity.com/t/getting-internal-id-from-from-device-agent-using-mqtt-client-connection/4000
**Category:** Forum
**Tags:** cumulocity, device-connectivity
**Created:** [July 4, 2022, 5:42pm UTC](https://community.cumulocity.com/t/getting-internal-id-from-from-device-agent-using-mqtt-client-connection/4000 "2022-07-04T17:42:10Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Balpreet\_Jaggi](https://avatars.discourse-cdn.com/v4/letter/b/a8b319/32.png) [@Balpreet\_Jaggi](https://community.cumulocity.com/u/Balpreet_Jaggi)
#### Post date: [July 4, 2022, 5:42pm UTC](https://community.cumulocity.com/t/getting-internal-id-from-from-device-agent-using-mqtt-client-connection/4000/1 "2022-07-04T17:42:10Z")

</div>

#### What product/components do you use and which version/fix level?

Cumulocity IoT 10.13

#### What are trying to achieve? Please describe in detail.

I want to get the internal id of the device in cumulocity using Mqtt smart rest templates. I am able to retreive the JWT token from the mqtt client and can use the identityApi rest call but is there a way to get the same using the mqtt client?

---

<div class="post-metadata">

### Author: ![Philipp\_Emmel](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/philipp_emmel/32/19455_2.png) [@Philipp\_Emmel](https://community.cumulocity.com/u/Philipp_Emmel)
#### Post date: [July 4, 2022, 6:54pm UTC](https://community.cumulocity.com/t/getting-internal-id-from-from-device-agent-using-mqtt-client-connection/4000/2 "2022-07-04T18:54:32Z")

</div>

Devices may query their own managed object using inventory GET templates (see: [SmartREST - Cumulocity IoT Guides](https://cumulocity.com/guides/reference/smartrest-two/#get-templates)) and a corresponding response template (see: [SmartREST - Cumulocity IoT Guides](https://cumulocity.com/guides/reference/smartrest-two/#response-templates)).

Here are a few screenshots that show how such a template collection may be configured:

 ![SR_deviceid_request](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/a/e/ae4625c6f881d40fd2b93b188643ac1d28308471.png)

 ![SR_deviceid_response](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/4/8/4851b90feed69eec28c243f9ed6c8240175d43fa.png)

 ![SR_deviceid_preview](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/e/0/e0bbedf6b9c00c34776522abc8b39dff1927343e.png)

---

<div class="post-metadata">

### Author: ![Murat\_Bayram](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/murat_bayram/32/3670_2.png) [@Murat\_Bayram](https://community.cumulocity.com/u/Murat_Bayram)
#### Post date: [July 6, 2022, 8:15am UTC](https://community.cumulocity.com/t/getting-internal-id-from-from-device-agent-using-mqtt-client-connection/4000/3 "2022-07-06T08:15:57Z")

</div>

Since I had this request quite often also in terms of child devices via [thin-edge.io](http://thin-edge.io) wouldn´t it make sense to have that as a standard template anyway @Philipp_Emmel ?

---

<div class="post-metadata">

### Author: ![Philipp\_Emmel](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/philipp_emmel/32/19455_2.png) [@Philipp\_Emmel](https://community.cumulocity.com/u/Philipp_Emmel)
#### Post date: [July 6, 2022, 10:27am UTC](https://community.cumulocity.com/t/getting-internal-id-from-from-device-agent-using-mqtt-client-connection/4000/4 "2022-07-06T10:27:03Z")

</div>

It is important to know that for almost all use cases in SmartREST 2 the internal IDs of devices and child devices are not necessary. SmartREST 2 is designed so that devices can use their own external ID in communication (see: [SmartREST - Cumulocity IoT Guides](https://cumulocity.com/guides/reference/smartrest-two/#concept-of-id-less-communication)).

That being said there are still a couple of advanced use cases where internal device IDs are required. I like the idea of adding a static request and response template for these functionalities.

---

<div class="post-metadata">

### Author: ![Stefan\_Witschel](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/stefan_witschel/32/31955_2.png) [@Stefan\_Witschel](https://community.cumulocity.com/u/Stefan_Witschel)
#### Post date: [July 6, 2022, 10:57am UTC](https://community.cumulocity.com/t/getting-internal-id-from-from-device-agent-using-mqtt-client-connection/4000/5 "2022-07-06T10:57:48Z")

</div>

@Murat_Bayram @Philipp_Emmel Can you create a Feature Request in aha so we can discuss in the DM Grooming?

---

<div class="post-metadata">

### Author: ![Murat\_Bayram](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/murat_bayram/32/3670_2.png) [@Murat\_Bayram](https://community.cumulocity.com/u/Murat_Bayram)
#### Post date: [July 6, 2022, 1:17pm UTC](https://community.cumulocity.com/t/getting-internal-id-from-from-device-agent-using-mqtt-client-connection/4000/6 "2022-07-06T13:17:56Z")

</div>

Done - [Link](https://trendminer.aha.io/products/C8YDVC/ideas_overview)

---

<div class="post-metadata">

### Author: ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/system/32/31990_2.png) [@system](https://community.cumulocity.com/u/system)
#### Post date: [October 4, 2022, 1:18pm UTC](https://community.cumulocity.com/t/getting-internal-id-from-from-device-agent-using-mqtt-client-connection/4000/7 "2022-10-04T13:18:10Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
