# SmartRest Response Template for Custom Operation

**URL:** <https://community.cumulocity.com/t/smartrest-response-template-for-custom-operation/12619>\
**Category:** Forum\
**Tags:** device-management, cumulocity\
**Created:** [August 18, 2025, 12:56pm UTC](https://community.cumulocity.com/t/smartrest-response-template-for-custom-operation/12619 "2025-08-18T12:56:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stefan\_Veit3](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/stefan_veit3/32/15532_2.png) [@Stefan\_Veit3](https://community.cumulocity.com/u/Stefan_Veit3)\
**Post date:** [August 18, 2025, 12:56pm UTC](https://community.cumulocity.com/t/smartrest-response-template-for-custom-operation/12619/1 "2025-08-18T12:56:02Z")

</div>

I have a microservice which creates a custom operation for a device. The devices subscribes via MQTT to the topic s/ds. As I understand as long as I have no response template defined, the operation is not available on this topic.

Now I created a SmartRest Response Template like this:

11,599,c8y\_Info,c8y\_Info.expireDate

Still no message arriving on the topic. What am I missing?

---

<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:** [August 18, 2025, 1:02pm UTC](https://community.cumulocity.com/t/smartrest-response-template-for-custom-operation/12619/2 "2025-08-18T13:02:58Z")

</div>

For built-in operations like `c8y_Command` you don’t need Response templates and can just subscribe on `s/ds`.  
For any other custom fragment you need to define a response template and need to subscribe to `s/dc/<template-id>`

See here: [SmartREST 2.0 - Cumulocity documentation](https://cumulocity.com/docs/smartrest/smartrest-two/)

---

<div class="post-metadata">

**Author:** ![Stefan\_Veit3](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/stefan_veit3/32/15532_2.png) [@Stefan\_Veit3](https://community.cumulocity.com/u/Stefan_Veit3)\
**Post date:** [August 18, 2025, 1:21pm UTC](https://community.cumulocity.com/t/smartrest-response-template-for-custom-operation/12619/3 "2025-08-18T13:21:37Z")

</div>

Yes, for built-in that works.

For the custom one: So I would need to subscribe to s/dc/599 given my example above?

Unfortunately this is not working. If I subscribe to devicecontrol/notifications I receive it.

---

<div class="post-metadata">

**Author:** ![Korbinian\_Butz1](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/korbinian_butz1/32/31227_2.png) [@Korbinian\_Butz1](https://community.cumulocity.com/u/Korbinian_Butz1)\
**Post date:** [August 18, 2025, 1:59pm UTC](https://community.cumulocity.com/t/smartrest-response-template-for-custom-operation/12619/4 "2025-08-18T13:59:02Z")

</div>

Is 599 the ID of your template collection? (Also called `X-ID`)

You stated you’re in a Microservice and you’re not using thin-edge. Nevertheless, the thin-edge docs [here](https://thin-edge.github.io/thin-edge.io/operate/c8y/smartrest-templates/#step-1-creating-a-smartrest-template) are giving an example on how to create a smart rest template in order to receive a custom operation (in this case under `s/dc/custom_devmgmt` ). Maybe that reference helps.

---

<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:** [August 18, 2025, 3:21pm UTC](https://community.cumulocity.com/t/smartrest-response-template-for-custom-operation/12619/5 "2025-08-18T15:21:59Z")

</div>

`599` is probably the msg-id but not the template-id as Korbinian commented already.  
Check the DM UI to find out the ID of your template:

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/7/d/7d38951590e00a0dbf28a12b425514098adc2c65.png)  
In my screen above `ID: test`

---

<div class="post-metadata">

**Author:** ![Stefan\_Veit3](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/stefan_veit3/32/15532_2.png) [@Stefan\_Veit3](https://community.cumulocity.com/u/Stefan_Veit3)\
**Post date:** [August 19, 2025, 6:03am UTC](https://community.cumulocity.com/t/smartrest-response-template-for-custom-operation/12619/6 "2025-08-19T06:03:20Z")

</div>

Perfect, thank you! I indeed used the wrong ID.
