Get promotion statistics
const url = 'https://apibase.ecomweb.app/api/v1/stores/example/promotions/stats/overview';const options = {method: 'GET', headers: {'x-api-key': '<x-api-key>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://apibase.ecomweb.app/api/v1/stores/example/promotions/stats/overview \ --header 'x-api-key: <x-api-key>'Returns how many promotions the store has in each status, how many times promotions were used on orders that are not cancelled, the total discount given and the five most used promotions.
Required scopes: read:promotions
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The store’s ref, as returned by GET /stores.
Responses
Section titled “Responses”object
The five most used promotions.
object
Promotion ID.
Promotion name.
Number of live orders that used the promotion.
Total discount the promotion gave across those orders.
Number of promotions, deleted ones excluded.
Number of ACTIVE promotions.
Number of DRAFT promotions.
Number of EXPIRED promotions.
Number of DISABLED promotions.
Number of order uses of promotions, counting orders that are not cancelled.
Total discount given through promotions on those orders.
Example generated
{ "top_promotions": [ { "id": 1, "name": "example", "usage_count": 1, "discount_amount": 1 } ], "total_promotions": 1, "active_promotions": 1, "draft_promotions": 1, "expired_promotions": 1, "disabled_promotions": 1, "total_usage": 1, "total_discount_amount": 1}The key is missing, invalid, revoked or expired.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The key may not do this: a missing scope, a readonly key, a publishable key on a Store API route, or a disallowed origin.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}