我在尝试创建新关键字时使用Amazon Advertising API时遇到此错误:
"code":"422“
这是我的PHP代码:
curl_setopt($ch, CURLOPT_URL, $std_url . "/v2/sp/keywords");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);
$data_string = array(
"campaignId" => "111111111111",
"adGroupId" => "2222222222222",
"state" => "enabled",
"keywordText" => "YetAnotherKeyword",
"matchType" => "broad",
"bid" => "0.05");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
$headers = array();
$headers[] = "Content-Type:application/json";
$headers[] = ("Authorization: Bearer " . $accesstoken);
$headers[] = ("Amazon-Advertising-API-ClientId: ". $client);
$headers[] = ("Amazon-Advertising-API-Scope: " . $API_Scope);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close ($ch);
echo $result;发布于 2021-11-25 20:43:04
我已经有了解决方案。需要像这样修改数组:
$data_string = array(array(
"campaignId" => "111111111111",
"adGroupId" => "2222222222222",
"state" => "enabled",
"keywordText" => "YetAnotherKeyword",
"matchType" => "broad",
"bid" => "0.05"));https://stackoverflow.com/questions/70087774
复制相似问题