Closed diegovsilva closed 1 year ago
Hi @diegovsilva, thanks for providing this feedback. At this time, the API does only support a single metric in the request, so this is working as designed. I will pass this feedback on to the product team, and if any changes are made, we will post in the release notes.
Describe the bug When using the Store Insights Api, we were unable to pass more than one metric as a parameter in the request (error attached).
Content URL url = "https://advertising-api.amazon.com/stores/######/insights" DOC: https://advertising.amazon.com/API/docs/en-us/stores/open-api#tag/Stores-Analytics/operation/getInsightsForStoreAPI
Description of what the documentation currently says
Array of strings (InsightMetric) Items Enum: "VIEWS" "ORDERS" "UNITS" "SALES" "VISITS" "VISITORS" "SCORE_LEVEL" "PERCENTILE_IN_PEERSET" "RECOMMENDATIONS" "CONTRIBUTORS" "DWELL" "PEER_DWELL" List of the insight metrics to be fetched. Only one metric should be specified.
Description of what the documentation should say We would like the return of more than one metric to extract the report.
Screenshots
Additional context Simple python script of the request where the error occurs:
import requests import json
url = "https://advertising-api.amazon.com/stores/######/insights"
payload = json.dumps({ "startDate": "2023-09-01", "endDate": "2023-09-30", "metrics": [ "VIEWS", "ORDERS", "UNITS", "SALES", "VISITS", "VISITORS" ] }) headers = { 'Content-Type': 'application/vnd.GetInsightsForStoreRequest.v1+json', 'Accept': 'application/vnd.GetInsightsForStoreResponse.v1+json', 'Amazon-Advertising-API-Scope': '1348112487580090', 'Amazon-Advertising-API-ClientId': 'amzn1.application-oa2-client.73b74b0f4211432aa311926ee842852a', 'Authorization': 'Bearer ####' }
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)