{ "swagger": "2.0", "info": { "title": "Selling Partner API for Sales", "description": "The Selling Partner API for Sales provides APIs related to sales performance.", "version": "v1", "contact": { "name": "Selling Partner API Developer Support", "url": "https://sellercentral.amazon.com/gp/mws/contactus.html" }, "license": { "name": "Apache License 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0" } }, "host": "sellingpartnerapi-na.amazon.com", "schemes": [ "https" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "definitions": { "GetOrderMetricsResponse": { "description": "The response schema for the getOrderMetrics operation.", "type": "object", "properties": { "payload": { "description": "The payload for the getOrderMetrics operation.", "$ref": "#/definitions/OrderMetricsList" }, "errors": { "description": "Encountered errors for the getOrderMetrics operation.", "$ref": "#/definitions/ErrorList" } } }, "OrderMetricsList": { "description": "A set of order metrics, each scoped to a particular time interval.", "type": "array", "items": { "$ref": "#/definitions/OrderMetricsInterval" } }, "OrderMetricsInterval": { "description": "Contains order metrics.", "type": "object", "properties": { "interval": { "description": "The interval of time based on requested granularity (ex. Hour, Day, etc.) If this is the first or the last interval from the list, it might contain incomplete data if the requested interval doesn't align with the requested granularity (ex. request interval 2018-09-01T02:00:00Z--2018-09-04T19:00:00Z and granularity day will result in Sept 1st UTC day and Sept 4th UTC days having partial data).", "type": "string" }, "unitCount": { "description": "The number of units in orders based on the specified filters.", "type": "integer" }, "orderItemCount": { "description": "The number of order items based on the specified filters.", "type": "integer" }, "orderCount": { "description": "The number of orders based on the specified filters.", "type": "integer" }, "averageUnitPrice": { "description": "The average price for an item based on the specified filters. Formula is totalSales/unitCount.", "$ref": "#/definitions/Money" }, "totalSales": { "description": "The total ordered product sales for all orders based on the specified filters.", "$ref": "#/definitions/Money" } }, "required": [ "averageUnitPrice", "interval", "orderCount", "orderItemCount", "totalSales", "unitCount" ] }, "Error": { "description": "Error response returned when the request is unsuccessful.", "properties": { "code": { "description": "An error code that identifies the type of error that occured.", "type": "string" }, "message": { "description": "A message that describes the error condition in a human-readable form.", "type": "string" }, "details": { "description": "Additional details that can help the caller understand or fix the issue.", "type": "string" } }, "required": [ "code", "message" ], "type": "object" }, "ErrorList": { "description": "A list of error responses returned when a request is unsuccessful.", "type": "array", "items": { "$ref": "#/definitions/Error" } }, "Money": { "description": "The currency type and the amount.", "properties": { "currencyCode": { "description": "Three-digit currency code. In ISO 4217 format.", "type": "string" }, "amount": { "description": "The currency amount.", "$ref": "#/definitions/Decimal" } }, "required": [ "amount", "currencyCode" ], "type": "object" }, "Decimal": { "description": "A decimal number with no loss of precision. Useful when precision loss is unacceptable, as with currencies. Follows RFC7159 for number representation.
**Pattern** : `^-?(0|([1-9]\\d*))(\\.\\d+)?([eE][+-]?\\d+)?$`.", "type": "string" } }, "paths": { "/sales/v1/orderMetrics": { "get": { "tags": [ "sales" ], "description": "Returns aggregated order metrics for given interval, broken down by granularity, for given buyer type.\n\n**Usage Plan:**\n\n| Rate (requests per second) | Burst |\n| ---- | ---- |\n| .5 | 15 |\n\nFor more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation.", "operationId": "getOrderMetrics", "responses": { "200": { "description": "OrderMetric action taken on the resource OrderMetrics.", "headers": { "x-amzn-RateLimit-Limit": { "description": "TPS throttle rate customer is authorized for.", "type": "string" }, "x-amzn-RequestId": { "description": "unique request reference id.", "type": "string" } }, "examples": { "payload": { "dayGranularity": { "metrics": [ { "interval": "2018-05-01T00:00-07:00--2018-05-02T00:00-07:00", "unitCount": 1, "orderItemCount": 1, "orderCount": 1, "averageUnitPrice": { "amount": "22.95", "currencyCode": "USD" }, "totalSales": { "amount": "22.95", "currencyCode": "USD" } }, { "interval": "2018-05-02T00:00-07:00--2018-05-03T00:00-07:00", "unitCount": 1, "orderItemCount": 1, "orderCount": 1, "averageUnitPrice": { "amount": "2.05", "currencyCode": "USD" }, "totalSales": { "amount": "2.05", "currencyCode": "USD" } } ] }, "totalGranularity": { "metrics": [ { "interval": "2018-05-01T00:00-07:00--2018-05-03T00:00-07:00", "unitCount": 2, "orderItemCount": 2, "orderCount": 2, "averageUnitPrice": { "amount": "12.5", "currencyCode": "USD" }, "totalSales": { "amount": "25", "currencyCode": "USD" } } ] }, "asinFilter": { "metrics": [ { "interval": "2018-05-01T00:00-07:00--2018-05-02T00:00-07:00", "unitCount": 1, "orderItemCount": 1, "orderCount": 1, "averageUnitPrice": { "amount": "22.95", "currencyCode": "USD" }, "totalSales": { "amount": "22.95", "currencyCode": "USD" } }, { "interval": "2018-05-02T00:00-07:00--2018-05-03T00:00-07:00", "unitCount": 0, "orderItemCount": 0, "orderCount": 0, "averageUnitPrice": { "amount": "0", "currencyCode": "USD" }, "totalSales": { "amount": "0", "currencyCode": "USD" } } ] } } }, "schema": { "$ref": "#/definitions/GetOrderMetricsResponse" }, "x-amazon-spds-sandbox-behaviors": [ { "request": { "parameters": { "granularity": { "value": "Total" } } }, "response": { "payload": [ { "interval": "2019-08-01T00:00-07:00--2018-08-03T00:00-07:00", "unitCount": 2, "orderItemCount": 2, "orderCount": 2, "averageUnitPrice": { "amount": "12.5", "currencyCode": "USD" }, "totalSales": { "amount": "25", "currencyCode": "USD" } } ] } }, { "request": { "parameters": { "granularity": { "value": "Day" } } }, "response": { "payload": [ { "interval": "2019-08-01T00:00-07:00--2018-08-02T00:00-07:00", "unitCount": 1, "orderItemCount": 1, "orderCount": 1, "averageUnitPrice": { "amount": "22.95", "currencyCode": "USD" }, "totalSales": { "amount": "22.95", "currencyCode": "USD" } }, { "interval": "2019-08-02T00:00-07:00--2018-08-03T00:00-07:00", "unitCount": 1, "orderItemCount": 1, "orderCount": 1, "averageUnitPrice": { "amount": "2.05", "currencyCode": "USD" }, "totalSales": { "amount": "2.05", "currencyCode": "USD" } } ] } }, { "request": { "parameters": { "granularity": { "value": "Total" }, "asin": { "value": "B008OLKVEW" } } }, "response": { "payload": [ { "interval": "2018-05-01T00:00-07:00--2018-05-03T00:00-07:00", "unitCount": 1, "orderItemCount": 1, "orderCount": 1, "averageUnitPrice": { "amount": "22.95", "currencyCode": "USD" }, "totalSales": { "amount": "22.95", "currencyCode": "USD" } } ] } }, { "request": { "parameters": { "granularity": { "value": "Day" }, "asin": { "value": "B008OLKVEW" } } }, "response": { "payload": [ { "interval": "2018-05-01T00:00-07:00--2018-05-02T00:00-07:00", "unitCount": 1, "orderItemCount": 1, "orderCount": 1, "averageUnitPrice": { "amount": "22.95", "currencyCode": "USD" }, "totalSales": { "amount": "22.95", "currencyCode": "USD" } }, { "interval": "2018-05-02T00:00-07:00--2018-05-03T00:00-07:00", "unitCount": 0, "orderItemCount": 0, "orderCount": 0, "averageUnitPrice": { "amount": "0", "currencyCode": "USD" }, "totalSales": { "amount": "0", "currencyCode": "USD" } } ] } } ] }, "400": { "description": "Request has missing or invalid parameters and cannot be parsed.", "headers": { "x-amzn-RateLimit-Limit": { "description": "TPS throttle rate customer is authorized for.", "type": "string" }, "x-amzn-RequestId": { "description": "Unique request reference id.", "type": "string" } }, "schema": { "$ref": "#/definitions/GetOrderMetricsResponse" } }, "403": { "description": "403 can be caused for reasons like Access Denied, Unauthorized, Expired Token, Invalid Signature or Resource Not Found.", "headers": { "x-amzn-RequestId": { "description": "Unique request reference id.", "type": "string" } }, "schema": { "$ref": "#/definitions/GetOrderMetricsResponse" } }, "404": { "description": "The resource specified does not exist.", "headers": { "x-amzn-RequestId": { "description": "Unique request reference id.", "type": "string" } }, "schema": { "$ref": "#/definitions/GetOrderMetricsResponse" } }, "413": { "description": "The request size exceeded the maximum accepted size.", "headers": { "x-amzn-RateLimit-Limit": { "description": "TPS throttle rate customer is authorized for.", "type": "string" }, "x-amzn-RequestId": { "description": "Unique request reference id.", "type": "string" } }, "schema": { "$ref": "#/definitions/GetOrderMetricsResponse" } }, "415": { "description": "The entity of the request is in a format not supported by the requested resource.", "headers": { "x-amzn-RateLimit-Limit": { "description": "TPS throttle rate customer is authorized for.", "type": "string" }, "x-amzn-RequestId": { "description": "Unique request reference id.", "type": "string" } }, "schema": { "$ref": "#/definitions/GetOrderMetricsResponse" } }, "429": { "description": "The frequency of requests was greater than allowed.", "headers": { "x-amzn-RateLimit-Limit": { "description": "TPS throttle rate customer is authorized for.", "type": "string" }, "x-amzn-RequestId": { "description": "Unique request reference id.", "type": "string" } }, "schema": { "$ref": "#/definitions/GetOrderMetricsResponse" } }, "500": { "description": "Encountered an unexpected condition which prevented the server from fulfilling the request.", "headers": { "x-amzn-RateLimit-Limit": { "description": "TPS throttle rate customer is authorized for.", "type": "string" }, "x-amzn-RequestId": { "description": "Unique request reference id.", "type": "string" } }, "schema": { "$ref": "#/definitions/GetOrderMetricsResponse" } }, "503": { "description": "Temporary overloading or maintenance of the server.", "headers": { "x-amzn-RateLimit-Limit": { "description": "TPS throttle rate customer is authorized for.", "type": "string" }, "x-amzn-RequestId": { "description": "Unique request reference id.", "type": "string" } }, "schema": { "$ref": "#/definitions/GetOrderMetricsResponse" } } }, "parameters": [ { "name": "marketplaceIds", "in": "query", "description": "A list of marketplace identifiers. Example: ATVPDKIKX0DER indicates the US marketplace.", "required": true, "type": "array", "items": { "type": "string" } }, { "name": "interval", "in": "query", "description": "A time interval used for selecting order metrics. This takes the form of two dates separated by two hyphens (first date is inclusive; second date is exclusive). Dates are in ISO8601 format and must represent absolute time (either Z notation or offset notation). Example: 2018-09-01T00:00:00-07:00--2018-09-04T00:00:00-07:00 requests order metrics for Sept 1st, 2nd and 3rd in the -07:00 zone.", "required": true, "type": "string" }, { "name": "granularityTimeZone", "in": "query", "description": "An IANA-compatible time zone for determining the day boundary. Required when specifying a granularity value greater than Hour. The granularityTimeZone value must align with the offset of the specified interval value. For example, if the interval value uses Z notation, then granularityTimeZone must be UTC. If the interval value uses an offset, then granularityTimeZone must be an IANA-compatible time zone that matches the offset. Example: US/Pacific to compute day boundaries, accounting for daylight time savings, for US/Pacific zone.", "type": "string" }, { "name": "granularity", "in": "query", "description": "The granularity of the grouping of order metrics, based on a unit of time. Specifying granularity=Hour results in a successful request only if the interval specified is less than or equal to 30 days from now. For all other granularities, the interval specified must be less or equal to 2 years from now. Specifying granularity=Total results in order metrics that are aggregated over the entire interval that you specify. If the interval start and end date don’t align with the specified granularity, the head and tail end of the response interval will contain partial data. Example: Day to get a daily breakdown of the request interval, where the day boundary is defined by the granularityTimeZone.", "required": true, "type": "string", "enum": [ "Hour", "Day", "Week", "Month", "Year", "Total" ], "x-docgen-enum-table-extension": [ { "value": "Hour", "description": "Hour" }, { "value": "Day", "description": "Day" }, { "value": "Week", "description": "Week" }, { "value": "Month", "description": "Month" }, { "value": "Year", "description": "Year" }, { "value": "Total", "description": "Total" } ] }, { "name": "buyerType", "in": "query", "description": "Filters the results by the buyer type that you specify, B2B (business to business) or B2C (business to customer). Example: B2B, if you want the response to include order metrics for only B2B buyers.", "type": "string", "enum": [ "B2B", "B2C", "All" ], "x-docgen-enum-table-extension": [ { "value": "B2B", "description": "Business to business." }, { "value": "B2C", "description": "Business to customer." }, { "value": "All", "description": "Business to business and business to customer." } ], "default": "All" }, { "name": "fulfillmentNetwork", "in": "query", "description": "Filters the results by the fulfillment network that you specify, MFN (merchant fulfillment network) or AFN (Amazon fulfillment network). Do not include this filter if you want the response to include order metrics for all fulfillment networks. Example: AFN, if you want the response to include order metrics for only Amazon fulfillment network.", "type": "string" }, { "name": "firstDayOfWeek", "in": "query", "description": "Specifies the day that the week starts on when granularity=Week, either Monday or Sunday. Default: Monday. Example: Sunday, if you want the week to start on a Sunday.", "type": "string", "enum": [ "Monday", "Sunday" ], "x-docgen-enum-table-extension": [ { "value": "Monday", "description": "Monday" }, { "value": "Sunday", "description": "Sunday" } ], "default": "Monday" }, { "name": "asin", "in": "query", "description": "Filters the results by the ASIN that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all ASINs. Example: B0792R1RSN, if you want the response to include order metrics for only ASIN B0792R1RSN.", "type": "string" }, { "name": "sku", "in": "query", "description": "Filters the results by the SKU that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all SKUs. Example: TestSKU, if you want the response to include order metrics for only SKU TestSKU.", "type": "string" } ] } } } }