Php 什么是openstack云高计报警创建错误;缺少参数:\";数据\“&引用;

Php 什么是openstack云高计报警创建错误;缺少参数:\";数据\“&引用;,php,codeigniter,rest,openstack,ceilometer,Php,Codeigniter,Rest,Openstack,Ceilometer,我面对这个错误: *{"error_message": {"debuginfo": null, "faultcode": "Client", "faultstring": "Missing argument: \"data\""}}* 我正在用php进行rest调用以创建报警,如下所示 $json = '\'{"alarm_actions": ["log:///tmp/tst.txt"], "description": " Test of CPU usage high", "thres

我面对这个错误:

*{"error_message": {"debuginfo": null, "faultcode": "Client", "faultstring":    "Missing argument: \"data\""}}*
我正在用php进行rest调用以创建报警,如下所示

$json = '\'{"alarm_actions": ["log:///tmp/tst.txt"], "description":  " Test of CPU usage high", "threshold_rule": {"meter_name": "cpu_usage_high", "evaluation_periods": 2, "period": 10, "statistic": "avg", "threshold": 40.0,"query":[{"field": "resource_id", "type": "", "value": "500a1594-4972-7968-2914-c333201585bd", "op": "eq"}], "comparison_operator": "gt" }, "repeat_actions": "FALSE", "type": "threshold", "name": "cpu_high_alarm_ada_9007"}\'';

$result = json_decode ($json);

$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER,$headers );
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS,$result);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);


$result     = curl_exec($curl);

检查json使用的有效性


这里,在json数据中,我发送的是“False”(带引号)。但服务器希望数据为false(不带引号)。

检查json使用的有效性

这里,在json数据中,我发送的是“False”(带引号)。但服务器期望数据为false(不带引号)