Closed SoporteBluco closed 1 year ago
Try this:
use SellingPartnerApi\Api\ReportsV20210630Api as ReportsApi;
use SellingPartnerApi\Model\ReportsV20210630 as Reports;
// ...
$apiInstance = new ReportsApi($config);
$spec = new Reports\CreateReportSpecification([
'report_type' => 'GET_FLAT_FILE_OPEN_LISTINGS_DATA',
'data_start_time' => '2023-06-01T00:00:00Z',
'data_end_time' => '2023-06-01T23:59:59Z',
'marketplace_ids' => implode(',', $marketplaceIds),
]);
try {
$result = $apiInstance->createReport($body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling ReportsV20210630Api->createReport: ', $e->getMessage(), PHP_EOL;
}
Hello i have the same issue.
$apiInstance = new SellingPartnerApi\Api\ReportsV20210630Api($config);
$body = new \SellingPartnerApi\Model\ReportsV20210630\CreateReportSpecification(['reportType' => 'GET_FLAT_FILE_ACTIONABLE_ORDER_DATA_SHIPPING', 'marketplaceIds' => 'APJ6JRA9NG5V4']);
try {
$result = $apiInstance->createReport($body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling ReportsV20210630Api->createReport: ', $e->getMessage(), PHP_EOL;
}
Error: Exception when calling ReportsV20210630Api->createReport: [400] { "errors": [ { "code": "InvalidInput", "message": "One or more required parameters missing", "details": "marketplaceIds;reportType;" } ] }
Solved with this code:
$marketplaceIds = array('APJ6JRA9NG5V4','A1RKKUPIHCS9HS','A1F83G8C2ARO7P','A13V1IB3VIYZZH','AMEN7PMS3EDWL','A1805IZSGTT6HS','A1PA6795UKMFR9','A2NODRKZP88ZB9','A1C3SOZRARQ6R3'); // string[] | A list of MarketplaceId values. Used to select orders that were placed in the specified marketplaces. See the [Selling Partner API Developer Guide](https://developer-docs.amazon.com/sp-api/docs/marketplace-ids) for a complete list of marketplaceId values.
$reportType = 'GET_FLAT_FILE_ACTIONABLE_ORDER_DATA_SHIPPING';
$body = new \SellingPartnerApi\Model\ReportsV20210630\CreateReportSpecification([
'marketplace_ids' => $marketplaceIds,
'report_type' => 'GET_FLAT_FILE_ACTIONABLE_ORDER_DATA_SHIPPING',
'data_start_time' => '2023-06-01T00:00:00Z',
]);
$apiInstance = new SellingPartnerApi\Api\ReportsV20210630Api($config);
//$body = new \SellingPartnerApi\Model\ReportsV20210630\CreateReportSpecification(); // \SellingPartnerApi\Model\ReportsV20210630\CreateReportSpecification
try {
$result = $apiInstance->createReport($body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling ReportsV20210630Api->createReport: ', $e->getMessage(), PHP_EOL;
}
Hello,
I'm executing this code:
and I receive this error:
My php version is: 8.0.25
I'm sure the data in .env is correct. I've tried a print_r($config) and I receive an array with all the Keys (LWA_CLIENT_ID, ....).
Thank you very much