本帖最后由 没有创意 于 2020-5-5 14:46 编辑
现在遇到个问题,我请求数据类似于
dev_mac=XXXXXXXXXX&commandvalue=1&commandcode=set_onoff&hmode=&modelnum=0&mid=8350&dev_type=802&key=1f50a306-af4b-4a86-92b8-9c8d519cf977
转换成{"mode":true,"dev_mac":"98D86XXXXXXX","commandvalue":true,"commandcode":"set_onoff","mid":"8350","dev_type":"12","key":"1f50a306-af4b-4a86-92b8-9c8d519cf977"}
测试了楼上两种方法都不行。
用在线POST工具测试了一下,https://www.sojson.com/http/test.html,,,批量参数设置格式就可以,JSON参数就不行,不知道怎么搞了
switch:
- platform: rest
name: "新风"
resource: http://mk.xxxx.com:8018/cominterface/index.aspx
method: POST
body_on: '{"mode":true,"dev_mac":"98Dxxxxxxx","commandvalue":true,"commandcode":"set_onoff","mid":"8350","dev_type":"12","key":"1f50a306-af4b-4a86-92b8-9c8d519cf977"}'
headers:
Content-Type: 'application/x-www-form-urlencoded;charset=utf-8'
rest_command:
xinfeng: #新风
url: http://mk.xxxx.com:8018/cominterface/index.aspx
method: POST
payload: '{"mode":"1","dev_mac":"98Dxxxxxx","commandvalue":"1","commandcode":"set_onoff","mid":"8350","dev_type":"12","key":"1f50a306-af4b-4a86-92b8-9c8d519cf977"}'
content_type: 'application/x-www-form-urlencoded;charset=utf-8'
|