-1

I am trying to expand string template for the cumulocity data. example ex-03-measurement.

I changed like below

//=================================================================== 10,103,POST,/measurement/measurements,application/json,,%%,NOW UNSIGNED NUMBER NUMBER NUMBER NUMBER,"{""time"":""%%"",""source"":{""id"":""%%""},""type"":""c8y_RHTMeasurement"",""c8y_RHTMeasurement"":{""RH"":{""value"":%%,""unit"":""%""},""Temperature"":{""value"":%%,""unit"":""C""},""Temperature1"":{""value"":%%,""unit"":""C""},""Temperature2"":{""value"":%%,""unit"":""C""}}}" //==================================================================

And I use the code like below

//================================================================== agent.send("103," + agent.ID() + "," + to_string(rh) + "," + to_string(temperature)+ "," + to_string(temperature)+"," + to_string(temperature)); //==================================================================

I always get response is

Is there have any one know how to expand the data on cumulocity server?

Add software debug log

Mar 30 11:17:28 DEBUG: HTTP recv: 
Mar 30 11:17:28 INFO: reporter: listening...
==============Mar 30 11:17:29 DEBUG: HTTP post: 15,24555
103,78561,86.000000,83.000000,83.000000,83.000000

Mar 30 11:17:29 DEBUG: HTTP recv: 45,2,Wrong number of arguments

Mar 30 11:17:29 DEBUG: Drop Msg 45
==============Mar 30 11:17:30 DEBUG: HTTP post: 15,24555
103,78561,15.000000,77.000000,77.000000,77.000000

Mar 30 11:17:30 DEBUG: HTTP recv: 45,2,Wrong number of arguments

Mar 30 11:17:30 DEBUG: Drop Msg 45
==============Mar 30 11:17:31 DEBUG: HTTP post: 15,24555
103,78561,35.000000,93.000000,93.000000,93.000000

Mar 30 11:17:31 DEBUG: HTTP recv: 45,2,Wrong number of arguments

Mar 30 11:17:31 DEBUG: Drop Msg 45
==============Mar 30 11:17:32 DEBUG: HTTP post: 15,24555
103,78561,92.000000,86.000000,86.000000,86.000000

Mar 30 11:17:32 DEBUG: HTTP recv: 45,2,Wrong number of arguments

Mar 30 11:17:32 DEBUG: Drop Msg 45
==============Mar 30 11:17:33 DEBUG: HTTP post: 15,24555
103,78561,21.000000,49.000000,49.000000,49.000000

Mar 30 11:17:33 DEBUG: HTTP recv: 45,2,Wrong number of arguments

Mar 30 11:17:33 DEBUG: Drop Msg 45
==============Mar 30 11:17:34 DEBUG: HTTP post: 15,24555
103,78561,27.000000,62.000000,62.000000,62.000000

Mar 30 11:17:34 DEBUG: HTTP recv: 45,2,Wrong number of arguments
Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56
連世鈺
  • 1
  • 4
  • 1
    The 2 in you response indicates that the second line of you request is wrong. So the first line seems to be correct. Your template and request is working for me from curl. Can you verify what is actually send. Maybe there is some additional line break at the end? Did you check if the measurement is created? – TyrManuZ Mar 29 '17 at 09:51
  • Edit add software log and template – 連世鈺 Mar 30 '17 at 03:32

1 Answers1

0

Finally I found the problem is My program *srversion can't be the same as before i tried. I learned a debug method for cumulocity.

1.changed your string template in your program. 2.Using curl to get the server recieved template. $ curl -u https://.cumulocity.com/inventory/managedObjects/X-Id

and then check the template is the same as template in your code.

thanks for your help.

連世鈺
  • 1
  • 4