aludvigsson / sqp-fetcher

Chrome extension for Amazon SQP Bulk downloader
12 stars 1 forks source link

Brand level #4

Open marcogioangeles opened 9 months ago

marcogioangeles commented 9 months ago

Hi Guys, actively learning how to develope extensions.

I want to extract brand data, can anyone lead me to the right path, what are ways I can do to find the right payload. I cannot find the api documentation for this. And I was amazed you found the right parameters to get asin level. I'm not asking for a complete solution, if you're passing by, any advice would be appreciated.

Not really an issue, sorry i'm new to github. 🙏

aludvigsson commented 9 months ago

@marcogioangeles hey! so for brand level, you need to look into the request that amazon makes in your developer tools network window

{ "viewId": "query-performance-brands-view", "filterSelections": [ { "id": "brand", "value": "337570", "valueType": null }, { "id": "reporting-range", "value": "weekly", "valueType": null }, { "id": "weekly-week", "value": "2024-01-20", "valueType": "weekly" } ], "selectedCountries": [ "us" ], "reportId": "query-performance-brand-report-table" }

so basicly you need to call this kind of request to below URL

const url = `${baseUrl}/api/brand-analytics/v1/dashboard/query-performance/reports`;

and then handle the response, you should be able to modify my code below and get it to work with brands instead of ASINs :)

sync function fetchData(asin, weekEndDate, marketplace) { console.log(marketplace); const payload = { viewId: "query-performance-asin-view", filterSelections: [ { id: "asin", value: asin, valueType: "ASIN" }, { id: "reporting-range", value: "weekly", valueType: null }, { id: "weekly-week", value: weekEndDate, valueType: "weekly" } ], selectedCountries: [marketplace.toLowerCase()], reportId: "query-performance-asin-report-table", reportOperations: [ { reportId: "query-performance-asin-report-table", reportType: "TABLE", pageNumber: 1, pageSize: 100, sortByColumnId: "qp-asin-query-rank", ascending: true } ], };

marcogioangeles commented 9 months ago

@marcogioangeles hey! so for brand level, you need to look into the request that amazon makes in your developer tools network window

{ "viewId": "query-performance-brands-view", "filterSelections": [ { "id": "brand", "value": "337570", "valueType": null }, { "id": "reporting-range", "value": "weekly", "valueType": null }, { "id": "weekly-week", "value": "2024-01-20", "valueType": "weekly" } ], "selectedCountries": [ "us" ], "reportId": "query-performance-brand-report-table" }

so basicly you need to call this kind of request to below URL

const url = `${baseUrl}/api/brand-analytics/v1/dashboard/query-performance/reports`;

and then handle the response, you should be able to modify my code below and get it to work with brands instead of ASINs :)

sync function fetchData(asin, weekEndDate, marketplace) { console.log(marketplace); const payload = { viewId: "query-performance-asin-view", filterSelections: [ { id: "asin", value: asin, valueType: "ASIN" }, { id: "reporting-range", value: "weekly", valueType: null }, { id: "weekly-week", value: weekEndDate, valueType: "weekly" } ], selectedCountries: [marketplace.toLowerCase()], reportId: "query-performance-asin-report-table", reportOperations: [ { reportId: "query-performance-asin-report-table", reportType: "TABLE", pageNumber: 1, pageSize: 100, sortByColumnId: "qp-asin-query-rank", ascending: true } ], };

Thank you very much!! I'll place a pull request when I'm done to share my learnings. 🙏