Sales Data
Claret Sales data APIs
The Sales GET
endpoint is paginated, so please refer to the Pagination documentation prior to usage.
As with all Claret API endpoints, the Sales APIs require token authentication. For instructions on how to retrieve and pass through the authentication token, please refer to the Authentication documentation.
All API documentation herein contains a {tenant}
section of the URL path. These should always be replaced with the name of the actual tenant making the API call (i.e., demo
, zymoeno
, etc.)
GET Sales
Sales data is available to retrieve at our RESTful GET
endpoint, and the structure of that data is somewhat customizable via the arguments described below.
GET
https://plan.claret.app/{tenant}/api/v1/sales
Retrieve paginated historical, forecast or transactional sales data.
Query Parameters
sale_type_name*
string
The name
of the Sale Type for the Sale records being retrieved (i.e., "History", "Forecast", etc.)
start_date*
date string
The start date of the query pull. Based on the sell_date.
Format: YYYY-MM-DD
duration*
integer
Integer value representing the number of days from the start date that the query should pull data for.
include_flattened_hierarchy
tiny integer (1 or 0)
When set to 1
(true), the flattened hierarchy levels for each of the Item
s and CustomerGroup
s will be provided in the payload.
current_index*
integer
For data loads larger than 1000 records, this parameter will not be required on the initial request, but must be included for each additional request. Please see the Pagination documentation for details.
The following examples contain the data structure for responses with and without the include_flattened_hierarchy
flag
POST Sales
Sales data can be posted to Claret using the RESTful POST
endpoint outlined below.
Please Note: This endpoint is currently in beta, and may not behave as expected.
⚠️ Do not use for production data.
POST
https://plan.claret.app/{tenant}/api/v1/sales
🚧 UNDER CONSTRUCTION 🚧
The POST
endpoint for Sales records receives an arguments
object and a content
array of Sales objects to be processed.
Request Body
arguments*
Object
The object containing key/value pairs for arguments pertaining to each of the objects within the "content" section - the "global" parameters for the request, as it were.
content*
Array
An array containing each of the Sales records objects that will be processed as part of the request.
(arguments) sale_type_name*
string
As part of the arguments
object, the sale_type_name
should correspond to the name
of the Sale Type that each of the Sale objects in the content
array should be associated with.
(arguments) create_missing_item_customer_group
tiny integer (1 or 0)
As part of the arguments
object, this boolean value informs us whether to generate new Item@CustomerGroup records during the processing of each Sale object in the content
array if the combination of values does not already exist.
(content) item_name*
string
As part of each object contained in the content
array, the name
of the Item in the Item@Customer Group that the Sale will be associated with must be provided. This Item must exist already within the data.
(content) customer_group_name*
string
As part of each object contained in the content
array, the name
of the Customer Group in the Item@Customer Group that the Sale will be associated with must be provided. This Customer Group must exist already within the data.
(content) sell_date*
date string
As part of each object contained in the content
array, the sell_date
for the Sale must be provided in the YYYY-MM-DD format.
(content) timing_interval_name*
string
As part of each object contained in the content
array, the span of the Timing Interval that should be used for the Sale record must be provided (i.e., "day", "week", "month", "year")
(content) quantity*
integer
As part of each object contained in the content
array, the quantity for the Sale record must be provided. 0 is ok, but no negative numbers will pass validations.
Last updated