首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Amazon Advertising API -发布关键字时的错误代码422

Amazon Advertising API -发布关键字时的错误代码422
EN

Stack Overflow用户
提问于 2021-11-23 21:02:22
回答 1查看 89关注 0票数 0

我在尝试创建新关键字时使用Amazon Advertising API时遇到此错误:

"code":"422“

这是我的PHP代码:

代码语言:javascript
复制
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;
EN

回答 1

Stack Overflow用户

发布于 2021-11-25 20:43:04

我已经有了解决方案。需要像这样修改数组:

代码语言:javascript
复制
$data_string = array(array(
    "campaignId" => "111111111111",
    "adGroupId" => "2222222222222",
    "state" => "enabled",
    "keywordText" => "YetAnotherKeyword",
    "matchType" => "broad",
    "bid" => "0.05"));
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70087774

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档