amzn / amazon-advertising-api-php-sdk Goto Github PK
View Code? Open in Web Editor NEW⛔️ DEPRECATED - Amazon Advertising API PHP Client Library
License: Apache License 2.0
⛔️ DEPRECATED - Amazon Advertising API PHP Client Library
License: Apache License 2.0
While going thru the Authorization process, we keep getting an error when trying to retrieve the refresh + access token.
{"error_description":"The request has an invalid grant parameter : code","error":"invalid_grant"}
After being redirected from LwA, we copy the Auth code exactly from the redirect_uri query string into our serversided call with cURL in order to get the refresh token, but we keep getting this error. Any help or suggestions?
Where can we get the accessToken/refreshToken?
Hi,
I hope all are doing well. i have try to get list campaign for vendor account. But, we get empty result. And we get list campaign for seller account using same code. please guide us for to get list campaigns for vendor account. Thanks for your advice.
As the title says, where do you find your accessToken or refreshToken?
Hi.
Im getting the report with this code snipped.
$request = $client->requestReport(
"campaigns",
array(
"reportDate" => "20210815",
// "campaignType" => "sponsoredProducts",
"metrics" => "campaignName,impressions,clicks,cost"
)
);`
Is there any way to get report for a time range, for example last 7 days or last 30 days?
Thank you.
Any roadmap to update to support all the new functions like get search terms etc?
How to us new amazon advertising api from php? return error:401
Using following example to update the campaign, but always getting 422 in response.
$client->updateCampaigns(
array(
array("campaignId" => 173284463890123,
"name" => "Update Campaign One",
"state" => "enabled",
"dailyBudget" => 10.99
)
)
);
Response
Array
(
[success] =>
[code] => 422
[response] => {"code":"422","requestId":"K07CM5C8BS3W78E1ZBAC"}
[requestId] => K07CM5C8BS3W78E1ZBAC
)
As per Doc this might use PUT request.
This isn't really a question about the library directly, but more hoping your experience with the actual API would give you answers.
I am having no problems with seller accounts, but the vendor profiles are not returning results in the API.
To be clear:
i'd expect calls to /profiles
to behave exactly the same no matter if the underlying account is vendor or seller.
With seller accounts i'm seeing all profiles, with vendor accounts the profiles are showing empty
When call listCampaigns, it returns error "Scope header is missing".
Is there anyway we can handle startIndex and count for the records?
i am not able to generate authorization code and refresh token because scope is unknown givw error like that how to solve tghis error
Is there a timeline for updates to this sdk for API V2?
i have used this amazon-advertising-api-php-sdk api but i got every time one error like Authentication failed.
so please suggest me how to solved that.
here is my code
$code = $_REQUEST['code'];
$postfields = array(
'grant_type'=>'authorization_code',
'code'=>$code,
'client_id'=>client_id,
'client_secret'=>client_secret
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.amazon.com/auth/o2/token');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/x-www-form-urlencoded;charset=UTF-8']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postfields));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // On dev server only!
$result = curl_exec($ch);
$newResult= json_decode($result);
$config = array(
"clientId" => client_id,
"clientSecret" => client_secret,
"region" => "na",
//"accessToken" => $newResult->access_token,
"refreshToken" => $newResult->refresh_token,
"sandbox" => TRUE);
$client = new Client($config);
$d=$client->registerProfile(array("countryCode" => "US"));
print_r($d);
Any chance to publish it on packagist?
Thanks
I'm trying to get a authorization and refresh tokens. According to the Amazon Ads API doc, I need the to substitute my values in the request:
curl \ -X POST \ -H "Content-Type:application/x-www-form-urlencoded;charset=UTF-8" \ --data "grant_type=authorization_code&code=AUTH_CODE&redirect_uri=YOUR_RETURN_URL&client_id=YOUR_CLIENT_ID&client_secret=YOUR_SECRET_KEY" \ https://api.amazon.com/auth/o2/token
I've replaced the parameter with my values, I want to know where to run the code, do I run it in the terminal or in the browser? Which part of the parameter should I run first, or do I copy and paste the whole parameter and run it at once?
Thanks for the help
I am trying to access the listProfiles but this gives me 401 error.
I am generating a valid access token and refresh token. doRefresh works completely fine and returns a new token but unable to fetch the data with the access token generated.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.