amzn / amazon-advertising-api-php-sdk

⛔️ DEPRECATED - Amazon Advertising API PHP Client Library
Apache License 2.0
93 stars 66 forks source link

change api to v2 #16

Open rams007 opened 5 years ago

rams007 commented 5 years ago

Hello. I update yours SDK to to work with the new version of API

rams007 commented 5 years ago

I also add new methods for auto targeting search terms. based on this:

This is to notify you of a change to search-terms reporting for auto-targeted campaigns. Search-terms report for auto-targeted campaigns generated before 11/14/2018 can be accessed from the endpoint: /v2/sp/keywords/report Search-terms report for auto-targeted campaigns generated on-and-after 11/14/2018 can be accessed from the endpoint: /v2/sp/targets/report Use query-segmentation to retrieve a search-terms report. Example search-terms report request for auto-targeted campaigns created before 11/14/2018: POST /v2/sp/keywords/report { "segment":"query", "reportDate":"20181113", "metrics":"impressions,clicks,..." } Example search-terms report request for auto-targeted campaigns created on-and-after 11/14/2018: POST /v2/sp/targets/report { "segment":"query", "reportDate":"20181201", "metrics":"impressions,clicks,..." } Please let us know if you experience any problems retrieving search-terms reporting for auto-targeted campaigns after reviewing these instructions. Best regards, Amazon Advertising API

sidrafarooq commented 5 years ago

@rams007

requestSnapshot doesn't need campaignType in v2

This should be $client->requestSnapshot( "campaigns", array("stateFilter" => "enabled,paused,archived", "campaignType" => "sponsoredProducts"));

changed to $client->requestSnapshot( "campaigns", array("stateFilter" => "enabled,paused,archived");

ahmedfeki commented 4 years ago

Thanks for the migration just a small correction for your example for creating target clause

$res = $client->createTargetingClauses(array(array( "campaignId" => 215604220644776, "adGroupId" => 239844918051417, "expressionType" => "manual", "expression" => array( array( "type" => "asinSameAs", "value" => "B078W31JTN" ) ), "bid" => 1.0, "state" => "enabled" )));

the expression require 2 arrays else you will get this error "code":"422","details":"The server understood your request but was unable to process one or more parameters."

i'm writing the full error because i'm sure someone coming from google with a little results and a hope to find a solution Thanks