CartonCloud
CartonCloud API

Endpoints related to Reports.


Request a report run.

POST
https://api.cartoncloud.com
/tenants/{tenantId}/report-runs
required permission: EDIT_REPORT_RUN (STOCK_ON_HAND) or EDIT_REPORT_RUN_BULK_CHARGES (BULK_CHARGES)

Create a report run. Report generation is performed asynchronously.

The request body is a report-run object with type and parameters. The returned object may differ from the request: omitted pageSize gets the default; values above 100 are capped at 100; other default parameters may be added; status is IN_PROCESS.

Use the returned id with Get Report Run to poll for completion. After the initial POST, wait about 10 seconds before the first GET, then use exponential back-off (20s, 40s, 80s). Most runs finish in several seconds; if still IN_PROCESS after one minute, send the create request again.

On success status becomes SUCCESS. On failure it becomes FAILED.

parameters is either stock-on-hand or bulk-charges, matching type.

Stock on hand aggregateBy: inboundOrder, location (unlimited-customer clients only), productGroup, productType. productStatus and unitOfMeasure are always applied. Custom product or purchase-order product fields may also be used.

Bulk charges dateFilter: date_added (charge created), date_invoice (invoice dates), date_activity (consignment delivered, manifest added, purchase order allocated, run sheet delivery date, sale order packed, storage period start/end).

Required permission depends on the report type:

  • STOCK_ON_HAND: EDIT_REPORT_RUN
  • BULK_CHARGES: EDIT_REPORT_RUN_BULK_CHARGES

Request a report run. › path Parameters

tenantId
​string · uuid · required

Tenant ID. Can be found in organisation settings

Request a report run. › Headers

Accept-Version
​string · enum · required

All API end points require Accept-Version in the request header.

Failure to provide the header will return a status code of 400, however, an invalid version can return a 404, 406 or 400.

Enum values:
8

Request a report run. › Request Body

Class AbstractApiEntity
type
​string · enum · required
Enum values:
BULK_CHARGES
STOCK_ON_HAND
status
​string · enum
Enum values:
FAILED
IN_PROCESS
SUCCESS
reportTime
​string · date-time

Time the report was generated.

​
id
​UUID · uuid

Request a report run. › Responses

Created. Body is the report-run object (status is IN_PROCESS).

Class AbstractApiEntity
type
​string · enum · required
Enum values:
BULK_CHARGES
STOCK_ON_HAND
status
​string · enum
Enum values:
FAILED
IN_PROCESS
SUCCESS
reportTime
​string · date-time

Time the report was generated.

​
id
​UUID · uuid

Get Report Run

GET
https://api.cartoncloud.com
/tenants/{tenantId}/report-runs/{reportRunId}
required permission: VIEW_REPORT_RUN (STOCK_ON_HAND) or VIEW_REPORT_RUN_BULK_CHARGES (BULK_CHARGES)

Retrieve the report run and, when complete, its result rows.

A successful HTTP status is 200 OK in all of these cases:

  • SUCCESS — items is the current page of rows (may be empty). Use pagination headers to iterate pages (see Pagination).
  • FAILED — failureDetails describes the error. HTTP status remains 200 OK.
  • IN_PROCESS — generation is still running; poll again.

Report data is retained for 7 days from processing. Older runs return 404 Not Found.

Required permission depends on the report type:

  • STOCK_ON_HAND: VIEW_REPORT_RUN
  • BULK_CHARGES: VIEW_REPORT_RUN_BULK_CHARGES

Get Report Run › path Parameters

tenantId
​string · uuid · required

Tenant ID. Can be found in organisation settings

reportRunId
​UUID · uuid · required

Report run ID

Example: 38756e85-d15c-45d9-84fd-1b3e50b73527

Get Report Run › query Parameters

page
​integer

The page number to return results for

Get Report Run › Headers

Accept-Version
​string · enum · required

All API end points require Accept-Version in the request header.

Failure to provide the header will return a status code of 400, however, an invalid version can return a 404, 406 or 400.

Enum values:
8

Get Report Run › Responses

Report run. Choose the schema variant that matches type and status.

SUCCESS includes items (the current page of rows; may be empty). FAILED includes failureDetails and not items. IN_PROCESS includes neither.

oneOf
Exactly one variant must match.

Decision Table

VariantMatching Criteria
type = object · requires: type, items
type = object · requires: type, items
type = object · requires: type, failureDetails
Properties for Stock on hand (SUCCESS):
Class AbstractApiEntity
type
​string · enum · const · required
Const value: STOCK_ON_HAND
Enum values:
BULK_CHARGES
STOCK_ON_HAND
​StockOnHandReportItem[] · required

Stock rows. Present when status is SUCCESS.

status
​string · enum · const
Const value: SUCCESS
Enum values:
FAILED
IN_PROCESS
SUCCESS
reportTime
​string · date-time

Time the report was generated.

​
id
​UUID · uuid