Implementation of a test task from Amazon
This document provides information about the endpoints available in the Sales and Traffic Report API.
- Get All Stats
- Get Stats by Date
- Get Stats Between Dates
- Get All Stats by ASIN
- Get Stats by ASIN
- Get Stats Between ASINs
- Create Authentication Token
- Create New User
Endpoint: GET /api/stats/allDates
Description: Retrieves all sales and traffic statistics grouped by Date..
Response:
- 200 OK: List of SalesAndTrafficByDataEntity entities.
- 204 No Content: If no data is available.
Endpoint: GET /api/stats/{date}
Description: Retrieves sales and traffic statistics for a specific date.
Parameters:
{date}: Date in the format specified by the application. Response:
- 200 OK: SalesAndTrafficByDataEntity.SalesAndTrafficByDate entity.
- 404 Not Found: If no data is available for the given date.
Endpoint: GET /api/stats/between-dates
Description: Retrieves sales and traffic statistics for a range of dates.
Parameters:
dates: Array of date strings representing the range. Response:
- 200 OK: List of SalesAndTrafficByDataEntity.SalesAndTrafficByDate entities.
- 204 No Content: If no data is available.
Endpoint: GET /api/stats/allAsin
Description: Retrieves all sales and traffic statistics grouped by ASIN.
Response:
- 200 OK: List of SalesAndTrafficByASINEntity entities.
- 204 No Content: If no data is available.
Endpoint: GET /api/stats/Asin/{asin}
Description: Retrieves sales and traffic statistics for a specific ASIN.
Parameters:
{asin}: ASIN (Amazon Standard Identification Number) of the product. Response:
- 200 OK: SalesAndTrafficByASINEntity.SalesAndTrafficByAsin entity.
- 404 Not Found: If no data is available for the given ASIN.
Endpoint: GET /api/stats/Asin/between-asins
Description: Retrieves sales and traffic statistics for a range of ASINs.
Parameters:
asins: Array of ASIN strings representing the range. Response:
- 200 OK: List of SalesAndTrafficByASINEntity.SalesAndTrafficByAsin entities.
- 204 No Content: If no data is available.
Endpoint: POST /api/stats/auth
Description: Creates an authentication token for the user.
Request Body: { "login": "exampleUser", "password": "examplePassword" }
Response:
- 200 OK: JWT authentication token.
- 401 Unauthorized: If the provided credentials are invalid.
Endpoint: POST /api/stats/regUser
Description: Creates a new user.
Request Body: { "login": "newUser", "password": "newPassword", }
Response:
- 201 Created: User created successfully.-
- 400 Bad Request: If the request is malformed or the user already exists.