double-break / spapi-php

Amazon Selling Partner API PHP Client
MIT License
56 stars 48 forks source link

Get Report GET_FLAT_FILE_ACTIONABLE_ORDER_DATA_SHIPPING (getReportDocument ) #53

Closed fruch17 closed 2 years ago

fruch17 commented 2 years ago

Hello, I need help.

I'm trying to get a report (GET_FLAT_FILE_ACTIONABLE_ORDER_DATA_SHIPPING) using the function getReportDocument , but the api return this error : "errors": [ { "message": "Access to requested resource is denied.", "code": "Unauthorized", "details": "" } ] and when we add the path : /reports/2021-06-30/reports, the api return this error : { "errors": [ { "code": "InvalidInput", "message": "Invalid or unsupported document ID found", "details": "" } ] }

Here are all our app authorization : https://prnt.sc/SR840DY3LRt1

This is our code to call the function getRdtCredentials :

$cred = $credentials->getRdtCredentials([ 'restrictedResources' => [ [ 'method' => 'GET', 'path' => '/orders/v0/orders' ], [ 'method' => 'GET', 'path' => '/orders/v0/orders/{orderId}/orderItems' ], [ 'method' => 'GET', 'path' => '/orders/v0/orders/{orderId}/address' ], [ 'method' => 'GET', 'path' => '/orders/v0/orders/{orderId}/buyerInfo' ], // [ // 'method' => 'GET', // 'path' => '/reports/2021-06-30/reports' // ] ] ]);

$request = new Reports($cred, $config); $reportDocumentId = $params['reportDocumentId']; $reports = $request->getReportDocument($reportDocumentId)

I really appreciate your help

Thank you.

lyubo-slavilov commented 2 years ago

It seems this report is part of the Restricted Data APis, so you need to exchange your access token for an RDT token (if your developer account is approved for that) You can check the README section about working with Restricted APIs and RDT https://github.com/double-break/spapi-php#working-with-restricted-data-apis