ForSURE.statisticspage.chart_management.chart_endpoints

baseURL = '/stats/charts'

Base URL for all requests

GET {baseURL}/custom/columns/
async def get_custom_column_options()

Get the possible column options for the x- and y-axis of a chart. You can use any combination of these to create a chart, but some are more useful than others.

Returns

Successful response

    {
    "Types of Sales": [
        "amount_total",
        "amount_b2b",
        "amount_b2c"
    ],
    "Orders": [
        "sku",

POST {baseURL}/custom/create/
async def create_custom_plot()

Create a chart using the given columns and filters. Data format returned might change slightly depending on number of x and y-axis values and chart type.

Parameters
  • chart: JSON containing the chart description and filters.

        {
            "chart_type": "Bar Chart",
            "title": "Product Net Weight (g) per Week",
            "x_columns": [
                "Week"
            ],
            "y_columns": [
                "Product Net Weight (g)",
                "Paper/Carton"
            ],
            "category": "Custom",
            "filters": {
                "country": [
                    "DE"
                ],
                "start_time": "2024-04-01",
                "end_time": "2024-04-28",
                "profile": [
                    "1"
                ],
                "report_name": [],
                "categories": []
            }
        }
    
Returns

Successful response Chart data

    {
    "data": {
        "Paper/Carton": {
            "2024-04-01T00:00:00": 76780,
            "2024-04-08T00:00:00": 40280,
            "2024-04-22T00:00:00": 70800
        },
        "Product Net Weight (g)": {
            "2024-04-01T00:00:00": 244000,
            "2024-04-08T00:00:00": 138500,
            "2024-04-22T00:00:00": 251500
        }
    },
    "xColumns": [
        "Week"
    ],
    "yColumns": [
        "Product Net Weight (g)",
        "Paper/Carton"
    ],
    "Week": [
        "2024-04-07T00:00:00",
        "2024-04-14T00:00:00",
        "2024-04-21T00:00:00",
        "2024-04-28T00:00:00"
    ]
}

POST {baseURL}/chart
async def get_chart_data()

Get every data point that contributed to the chart defined. This will return all products that were applicable and will contain all relevant columns.

Parameters
  • chart: JSON containing the chart description and filters.

        {
            "chart_type": "Bar Chart",
            "title": "Product Net Weight (g) per Week",
            "x_columns": [
                "Week"
            ],
            "y_columns": [
                "Product Net Weight (g)",
                "Paper/Carton"
            ],
            "category": "Custom",
            "filters": {
                "country": [
                    "DE"
                ],
                "start_time": "2024-04-01",
                "end_time": "2024-04-28",
                "profile": [
                    "1"
                ],
                "report_name": [],
                "categories": []
            }
        }
    
Returns

Successful response

    [
    {
        "name": "Fitness Tracker Watch",
        "country": "DE",
        "profile": "1. Shopify",
        "Week": "01-04-24",
        "Product Net Weight (g)": 1000,
        "Paper/Carton": 600
    },
    {
        "name": "Solar Panel Charger",
        "country": "DE",
        "profile": "1. Shopify",
        "Week": "01-04-24",
        "Product Net Weight (g)": 1000,
        "Paper/Carton": 400
    },