使用REST API更新配置

时间:2017-01-04 13:53:29

标签: rest api kaa

我使用kaa rest api来改变我的配置如下:

curl -v -S -u devuser:devuser123 -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{
"applicationId": "2",
"schemaId": "65539",
"endpointGroupId": "32768",
"body": "{\"timeConfig\":{\"org.kaaproject.configuration.unchangedT\":\"unchanged\"},\"dailySchedules\":{\"org.kaaproject.configuration.unchangedT\":\"unchanged\"},\"enabled\":{\"boolean":false},\"relays\":{\"array\":[false,false,false,true,true,false,false,false]},\"samplePeriod\":{\"int\":9}}",
}' 'http://localhost:8080/kaaAdmin/rest/api/configuration' | python -mjson.tool

但我得HTTP/1.1 400 Bad Request。我的帖子参数好吗?任何建议将不胜感激。

1 个答案:

答案 0 :(得分:2)

最后我发现了问题。 Kaa Rest API工作完美。它是关于schemaID和endpointgroupId的不匹配。我从kaa web界面获得了正确的值: http://localhost:8080/kaaAdmin/#config:appId=2&endGroupId=32768&create=false&active=true&random=0.19035219790078206&schemaId=65539 。由于Rest文档中没有400 ERROR CODE,我不知道问题在哪里。

相关问题