How to check measurements of custom templates?

Hi,

I have created a SmartRest measurement template using the UI. I added only one parameter and keep the $time and $type empty for this test. Now the preview is this:

1001,<$.type>,<$.time>,

I am PUBLISH’ing below message and I don’t get any error message:

Topic: s/uc/template1
Msg:1001,TESTRESULT

If I change the message it to 1002, I get an error saying there is no template with this id. So I assumed I’m going well. But I couldn’t find how to check the received measurement. There is nothing on the UI and I can not see those packets in the response of the GET request to {{url}}/measurement/measurements.

What am I doing wrong?

Also, I created a response in this template and checked the “Include response” option in the measurement message template. But I can not get any response. Is there any way to bind this response to that message? Or where do we subscribe to get the response? I tried below topics:

s/uc/template1
s/uc/#
s/uc

Is there any step by step example of how to create a custom template using the UI?

Regards.

I found out that there is a problem with string type. I changed it to number and it worked. But I don’t know what if we want to send string as a measurement. Are we only allowed to send numbers as measurement?

Anyway, I have found a question on StackOverflow. You can check the answer, it also describe how to set custom types. I used the predefined battery level type and I can see the result on the Measurements UI. Check the attached image for reference.

Regarding the second question. I’m still trying to understand how to see the response of the message.

I forgot to mention the stackoverflow link: https://stackoverflow.com/a/51158907/5182362

Hi Abdullah,

have you checked our SmartRest documentation: https://cumulocity.com/guides/reference/smartrest/?

best regards
Michael