orders

Query date_breakdown on orders

Date breakdowns summarizes metrics data grouped by time intervals on a defined time range. They also support support breakdowns over the main date breakdown query and also supports all breakdown queries capabilities through the "breakdown" key, this also includes the possibility of nesting the breakdown over the main breakdown.

Single date breakdown request (no breakdown)

{ "date_breakdown": { "by": "shipments.cancelled_at", "field": "order.id", "interval": "month", "operator": "value_count" } }

Single date breakdown request with one breakdown

{ "date_breakdown": { "by": "shipments.cancelled_at", "field": "order.id", "interval": "month", "operator": "value_count", "breakdown": { "by": "order.currency_code", "field": "order.total_amount_with_taxes", "operator": "sum", "sort": "desc", "limit": 5 } } }

Single date breakdown request with breakdown with a nested breakdown

{ "date_breakdown": { "by": "order.placed_at", "field": "order.total_amount_with_taxes", "operator": "stats", "interval": "month", "breakdown": { "by": "order.country_code", "field": "line_items.total_amount", "operator": "sum", "sort": "desc", "limit": 20, "breakdown": { "by": "order.currency_code", "field": "line_items.total_amount", "operator": "sum", "sort": "desc", "limit": 21 } } } }

post/orders/date_breakdown

Request

  • Base URL
    https://{your-domain}.commercelayer.io/metrics
  • URL
    https://{your-domain}.commercelayer.io/metrics/orders/date_breakdown
  • Auth
    HTTP bearer

Request body

Example request

{
  "filter": {
    "line_items": {
      "discount": {
        "gt_lt": [
          121
        ]
      },
      "options_amount": {
        "gt_lt": [
          121
        ]
      },
      "quantity": {
        "gt_lt": [
          8
        ]
      },
      "tax_amount": {
        "gt_lt": [
          121
        ]
      },
      "tax_rate": {
        "gt_lt": [
          121
        ]
      },
      "total_amount": {
        "gt_lt": [
          121
        ]
      },
      "unit_amount": {
        "gt_lt": [
          121
        ]
      },
      "updated_at": {
        "gt_lt": [
          "2022-07-06T21:41:03Z"
        ]
      }
    },
    "line_items.options": {
      "quantity": {
        "gt_lt": [
          8
        ]
      },
      "total_amount": {
        "gt_lt": [
          121
        ]
      },
      "unit_amount": {
        "gt_lt": [
          121
        ]
      }
    },
    "market": {
      "numbers": {
        "in": [
          8
        ]
      }
    },
    "order": {
      "date_from": "2022-07-06T21:41:03Z",
      "date_to": "2022-07-06T21:41:03Z",
      "adjustment_amount": {
        "gt_lt": [
          121
        ]
      },
      "adjustment_tax_amount": {
        "gt_lt": [
          121
        ]
      },
      "adjustment_taxable_amount": {
        "gt_lt": [
          121
        ]
      },
      "approved_at": {
        "gt_lt": [
          "2022-07-06T21:41:03Z"
        ]
      },
      "archived_at": {
        "gt_lt": [
          "2022-07-06T21:41:03Z"
        ]
      },
      "cancelled_at": {
        "gt_lt": [
          "2022-07-06T21:41:03Z"
        ]
      },
      "created_at": {
        "gt_lt": [
          "2022-07-06T21:41:03Z"
        ]
      },
      "discount_amount": {
        "gt_lt": [
          121
        ]
      },
      "duty_amount": {
        "gt_lt": [
          121
        ]
      },
      "fulfillment_updated_at": {
        "gt_lt": [
          "2022-07-06T21:41:03Z"
        ]
      },
      "gift_card_amount": {
        "gt_lt": [
          121
        ]
      },
      "line_item_options_count": {
        "gt_lt": [
          8
        ]
      },
      "numbers": {
        "in": [
          8
        ]
      },
      "payment_method_amount": {
        "gt_lt": [
          121
        ]
      },
      "payment_method_tax_amount": {
        "gt_lt": [
          121
        ]
      },
      "payment_method_taxable_amount": {
        "gt_lt": [
          121
        ]
      },
      "payment_updated_at": {
        "gt_lt": [
          "2022-07-06T21:41:03Z"
        ]
      },
      "placed_at": {
        "gt_lt": [
          "2022-07-06T21:41:03Z"
        ]
      },
      "shipments_count": {
        "gt_lt": [
          8
        ]
      },
      "shipping_amount": {
        "gt_lt": [
          121
        ]
      },
      "shipping_taxable_amount": {
        "gt_lt": [
          121
        ]
      },
      "skus_count": {
        "gt_lt": [
          8
        ]
      },
      "subtotal_amount": {
        "gt_lt": [
          121
        ]
      },
      "subtotal_tax_amount": {
        "gt_lt": [
          121
        ]
      },
      "subtotal_taxable_amount": {
        "gt_lt": [
          121
        ]
      },
      "total_amount": {
        "gt_lt": [
          121
        ]
      },
      "total_amount_with_taxes": {
        "gt_lt": [
          121
        ]
      },
      "total_tax_amount": {
        "gt_lt": [
          121
        ]
      },
      "total_taxable_amount": {
        "gt_lt": [
          121
        ]
      },
      "updated_at": {
        "gt_lt": [
          "2022-07-06T21:41:03Z"
        ]
      },
      "current_date": {
        "gt_lt": [
          "2022-07-06T21:41:03Z"
        ]
      },
      "seconds_in_draft": {
        "gt_lt": [
          8
        ]
      },
      "seconds_in_approved": {
        "gt_lt": [
          8
        ]
      },
      "seconds_in_placed": {
        "gt_lt": [
          8
        ]
      },
      "placed_day_of_week": {
        "gt_lt": [
          8
        ]
      },
      "refunds_total_amount_with_taxes": {
        "gt_lt": [
          8
        ]
      },
      "total_amount_with_taxes_net_of_refunds": {
        "gt_lt": [
          121
        ]
      }
    },
    "refunds": {
      "amount": {
        "gt_lt": [
          121
        ]
      }
    },
    "shipments": {
      "items_count": {
        "gt_lt": [
          8
        ]
      },
      "cost_amount": {
        "gt_lt": [
          8
        ]
      },
      "cancelled_at": {
        "gt_lt": [
          "2022-07-06T21:41:03Z"
        ]
      },
      "delivered_at": {
        "gt_lt": [
          "2022-07-06T21:41:03Z"
        ]
      },
      "on_hold_at": {
        "gt_lt": [
          "2022-07-06T21:41:03Z"
        ]
      },
      "picking_at": {
        "gt_lt": [
          "2022-07-06T21:41:03Z"
        ]
      },
      "packing_at": {
        "gt_lt": [
          "2022-07-06T21:41:03Z"
        ]
      },
      "ready_to_ship_at": {
        "gt_lt": [
          "2022-07-06T21:41:03Z"
        ]
      },
      "shipped_at": {
        "gt_lt": [
          "2022-07-06T21:41:03Z"
        ]
      },
      "created_at": {
        "gt_lt": [
          "2022-07-06T21:41:03Z"
        ]
      },
      "updated_at": {
        "gt_lt": [
          "2022-07-06T21:41:03Z"
        ]
      },
      "seconds_in_picking": {
        "gt_lt": [
          8
        ]
      },
      "seconds_in_ready_to_ship": {
        "gt_lt": [
          8
        ]
      },
      "seconds_in_shipped": {
        "gt_lt": [
          8
        ]
      },
      "fulfillment_time": {
        "gt_lt": [
          8
        ]
      }
    },
    "resource_errors": {
      "created_at": {
        "gt_lt": [
          "2022-07-06T21:41:03Z"
        ]
      },
      "updated_at": {
        "gt_lt": [
          "2022-07-06T21:41:03Z"
        ]
      }
    }
  }
}

Response

The date_breakdown result from orders

Changes

No recorded changes to this operation across all 1 revision of this API.