ec2/saveEvenRules format
CompletedHi,
I am trying to create a API to save a generic rule that pops out a layout with camera when calls. I manaully created the rule and it works fine. use Get /ec2/getEventRules I can see the response as below
{"actionParams":{"actionResourceId":"{51ef01a3-8916-44bf-819d-cf04d6b9d469}",
"additionalResources":["d61a98ef-f22b-400b-b7d3-1fd4de2741c8"],
"allUsers":true,
"authType":"authBasicAndDigest",
"durationMs":5000,
"forced":true,
"fps":10,
"needConfirmation":false,
"playToClient":true,
"recordAfter":0,
"recordBeforeMs":0,
"streamQuality":"highest",
"useSource":false},
"actionResourceIds":[],
"actionType":"openLayoutAction",
"aggregationPeriod":60,
"comment":"",
"disabled":false,
"eventCondition":{"caption":"faceblacklist","eventTimestampUsec":"0","eventType":"undefinedEvent","metadata":{"allUsers":false,"level":""},"omitDbLogging":false,"progress":0,"reasonCode":"none"},
"eventResourceIds":[],
"eventState":"Undefined",
"eventType":"userDefinedEvent",
"id":"{4d5417da-b490-468b-a0e3-6387bf8bcb38}",
"schedule":"",
"system":false}
However just change the ID to another new UUID, the Post /ec2/saveEvenRules call always return 200 with invalid Parameter, any suggestion? Thanks
-
Please ignore this ticket, I figured it out the problem.
Thanks!
0 -
Hi Sam,
OK, thanks. It is likely you can refer to this post, sometimes if you use the API-test-tool, the hidden chars or the escape chars might causing issues.The json I tried here seems working well (notice: not the same ID, but a new generated one)
{
"actionParams":{
"actionResourceId":"{51ef01a3-8916-44bf-819d-cf04d6b9d469}",
"additionalResources":[
"d61a98ef-f22b-400b-b7d3-1fd4de2741c8"
],
"allUsers":true,
"authType":"authBasicAndDigest",
"durationMs":5000,
"forced":true,
"fps":10,
"needConfirmation":false,
"playToClient":true,
"recordAfter":0,
"recordBeforeMs":0,
"streamQuality":"highest",
"useSource":false
},
"actionResourceIds":[
],
"actionType":"openLayoutAction",
"aggregationPeriod":60,
"comment":"",
"disabled":false,
"eventCondition":{
"caption":"faceblacklist",
"eventTimestampUsec":"0",
"eventType":"undefinedEvent",
"metadata":{
"allUsers":false,
"level":""
},
"omitDbLogging":false,
"progress":0,
"reasonCode":"none"
},
"eventResourceIds":[
],
"eventState":"Undefined",
"eventType":"userDefinedEvent",
"id":"{4d5417da-b490-468b-a0e3-6387bf8bcb38}",
"schedule":"",
"system":false
}0 -
Thanks Ichiro. I thought string after actionparams & eventcondition are json object. didnt realize they are enquoted JSON strings containing a JSON object. so I fixed that by adding escape chars
0
Please sign in to leave a comment.
Comments
3 comments