report
Description
To generate a report, send a POST
request to the reports
resource with the specified parameters detailed in the Properties section.
Report generation happens asynchronously, and may take a number of minutes to prepare. The status
value in the report
resource indicates whether the report is ready to download.
The report resource represents a previously requested or generated file (typically CSV) summarizing or detailing various store data, such as a customer export, sales summaries, lifetime value, etc.
Once the report is ready (indicated via the status
parameter returning ready
), a fx:download_url
link rel will be present with a link to download the report(s). This link will only work for 10 minutes, after which point another link must be generated by making a GET request to the resource or collection. Note that the exact lifespan of this link may change in the future.
Actions
- GET
- View a report
- HEAD
- Get just the header response
- OPTIONS
- Get a response explaining which HTTP methods are supported
Properties
Property | Description | Type | Constraints |
---|---|---|---|
name | The type of report generated, indicating the content of the report. "Complete" includes transaction details, summaries, coupon usage, subscription forecasts, and more. "Customers" is for exporting customers to import elsewhere. "Customers_LTV" includes the lifetime value per customer. | Must be one of the following: complete , customers , customers_ltv |
Required |
version | In the event a report changes significantly, a new version of the report may be available. Leave this empty to retrieve the latest version, or pass a 1 to request a specific version. In the future, additional versions of each name d report may be available. |
string (50 character max). The only valid value at this time is 1 . |
Required |
datetime_start | A timestamp in the YYYY-MM-DD HH:MM:SS format, for the start of the reporting period, for your store's configured timezone. Note that any offset will be ignored, and the datetime passed in will be used as your store's configured timezone. |
datetime | Required |
datetime_end | Same as datetime_start , but for the end of the report's timeframe. Note that you likely want to pass 23:59:59 as the time portion, or you may inadvertently miss data from the last day of the reporting period. |
datetime | Required |
status | Possible values include queued , error , and ready . |
String | Read only |
date_created | The date this resource was created. | Date | Read only |
date_modified | The date this resource was last modified. | Date | Read only |
Example Representation
{ "_links": { "curies": [ { "name": "fx", "href": "https://api.foxycart.com/rels/{rel}", "templated": true } ], "self": { "href": "https://api.foxycart.com/report/1", "title": "This Report" }, "fx:download_url": { "href": "https://path.to.domain.tld/store_1/complete_report.1647049118670.zip?foo=bar", "title": "Download This Report" }, "fx:user": { "href": "https://api.foxycart.com/users/1", "title": "This User" } }, "name": "complete", "version": "1", "datetime_start": "2022-01-01T00:00:00-0800", "datetime_end": "2022-01-31T23:59:59-0800", "status": "ready", "date_created": "2022-03-11T17:38:02-0800", "date_modified": "2022-03-11T17:38:38-0800" }