我使用编辑广告的方法。
作为回应,我收到以下错误:
["error_code"]=>100
["error_msg"]=>"One of the parameters specified was missing or invalid: data[data][ad_id] is invalid"
数据数组本身:
string(185) "{"data":{"0":{"ad_id":"15142751","cpc":4.4},"1":{"ad_id":"15142643","cpc":4.4},"2":{"ad_id":"15210287","cpc":4.4},"3":{"ad_id":"15210280","cpc":4.4},"4":{"ad_id":"15210269","cpc":4.4}}}"
广告 ID 是正确的,很可能我正在神经形成一个对象数组。
$data = json_encode(array('data' => $data), JSON_FORCE_OBJECT);
有错误的完整响应:
array(1) {
["error"]=>
array(3) {
["error_code"]=>
int(100)
["error_msg"]=>
string(84) "One of the parameters specified was missing or invalid: data[data][ad_id] is invalid"
["request_params"]=>
array(5) {
[0]=>
array(2) {
["key"]=>
string(5) "oauth"
["value"]=>
string(1) "1"
}
[1]=>
array(2) {
["key"]=>
string(6) "method"
["value"]=>
string(13) "ads.updateAds"
}
[2]=>
array(2) {
["key"]=>
string(10) "account_id"
["value"]=>
string(10) "xxxxxxxxxx"
}
[3]=>
array(2) {
["key"]=>
string(4) "data"
["value"]=>
string(151) "{"data":[{"ad_id":22981362,"cpc":4.4},{"ad_id":22975854,"cpc":4.4},{"ad_id":22721708,"cpc":4.4},{"ad_id":26690417,"cpc":0},{"ad_id":22690359,"cpc":0}]}"
}
[4]=>
array(2) {
["key"]=>
string(1) "v"
["value"]=>
string(4) "5.62"
}
}
}
}
account_idAdvertising account ID required parameter, int (number)
但你没有。从文档中:
ad_id integer, required
你给出了这些行。你用
, JSON_FORCE_OBJECT
什么?API 需要一个对象数组dataSerialized JSON array of objects that describe changes in ads
。看起来 API 正在等待:
和你: