我们使用RTI webhook发布消息通知以将其存储在Cloudant DB
中。我们将{{message}}
参数传递给POST调用主体。在存储时,我们注意到每quote(")
之前的"/"
字符。这似乎是一个错误,因为这会使JSON在后期阶段无效。下面是什么{{message}}
包含在我们的例子中的一个例子bluemix IOT实时洞察webhook {{message}}包含无效字符
“{\” d \ “:{\” Energy_Consumption \ “150 \” 压力\ “:36.84546626947179,\” water_usage \“: 1640.0274074248778,\ “TEMP \”:45},\ “TS \”:\ “2016-03-15T06:48:02.320 + 0000 \”,\ “ruleContent \”:{\ “ID \”:\“J4jn6Wqv \ “,\”contextSchemas \“:[],\”ruleCondition \“:\”IOT_DeviceSchema.d.temp> 40 AND IOT_DeviceSchema.d.pressure < 80 AND IOT_DeviceSchema.d.Energy_Consumption> 100 \“,\”messageSchemas \ “:[\” IOT_DeviceSchema \ “],\” 作业ID \ “:\” tOXtlQLA \” \ “名称\”:\ “Device_Alert \”,\ “严重性\”:2,\ “动作\”:[ \ “Xfy2CCx6 \”],\ “变换\”:[],\ “目的地\”:\ “tenant.228e9515-9a62-448a-ba9a-a570000ba619.ruleOutput \”},\ “DEVICEID \”:\“ftkgac :IOTsample_devicetype:Device03 \“}”
webhook操作中使用的内容类型是什么? – bryantsai
内容类型在webhook信息下设置为application/json。虽然没有设置其他标题。 –