Each of the OFN reports has an associated endpoint. The URL of the endpoint will be the same as the URL of the report in super admin, for example:

  • https://INSTANCE_URL/api/v0/reports/orders_and_fulfillment/order_cycle_customer_totals

  • https://INSTANCE_URL/api/v0/reports/order_cycle_management/payment_methods

An example URL request including a parameter might be:

  • https://INSTANCE_URL/api/v0/reports/orders_and_fulfillment/order_cycle_customer_totals?q[order_cycle_id_in]=xx&q[created_at_lt]=xx

Some other points to note when using the reports API:

  • The feature is behind a feature toggle and the toggle ignores user-level toggles. Instance managers need to enable the feature for all users.

Running the report you require from the admin screen will give you the exact parameters you need. In Google Chrome, go to Developer Tools, Network, Payload. In Mozilla, go to Web Developer Tools, Network, Request.

Query parameters

You need to supply at least one search parameter, e.g.:

  • q[completed_at_gt]=

    • This is the lower bound of your desired date range (the start date)

      • Use the date format: "YYYY-MM-DD"

      • Or the datetime format: "YYYY-MM-DD+HH:MM"

  • q[completed_at_lt]=

    • This is the upper bound of your desired date range (the end date)

      • Use the date format: "YYYY-MM-DD"

      • Or the datetime format: "YYYY-MM-DD+HH:MM"

  • q[distributor_id_in]=

  • q[order_cycle_id_in]=

Display format

Header and footer rows don't display by default, but may be enabled:

  • display_header_row=true

  • display_summary_row=true

    • Due to the tabular format of reports, this has the same data structure as other rows.

    • Use fields_to_show[]=report_row_type to differentiate between summary and other rows.

More parameters can be observed in the developer tools network tab when you run the report in the admin interface.

If you do not specify a date range start or end point, the request will default to only getting the last month's worth of data. Set a start date (completed_at_gt) before the enterprise's first order to therefore display all orders.

Last updated