I'm getting this error using Amazon Advertising API while trying to create new keywords:
"code":"422"
This is my PHP Code:
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;
> 422 Unprocessable Entity (WebDAV; RFC 4918) > The request was well-formed but was unable to be followed due to semantic errors – quinny Nov 27 '21 at 22:59