itemInventoryExport Mutation
Description
Exports inventory data to a file based on type and filters. Supports filtering by inventory criteria and sales date ranges. Returns a background job that processes the export asynchronously: poll jobs until its status is "complete", then request the file with jobDownloadUrl.
mutation itemInventoryExport(
$type: String
$exportType: InventoryExportType
$filters: JSON
$filtersV2: InventoryFilters
$salesPaymentDateFrom: Date
$salesPaymentDateTo: Date
$salesShippingDateFrom: Date
$salesShippingDateTo: Date
$salesCreatedDateFrom: Date
$salesCreatedDateTo: Date
) {
itemInventoryExport(
type: $type
exportType: $exportType
filters: $filters
filtersV2: $filtersV2
salesPaymentDateFrom: $salesPaymentDateFrom
salesPaymentDateTo: $salesPaymentDateTo
salesShippingDateFrom: $salesShippingDateFrom
salesShippingDateTo: $salesShippingDateTo
salesCreatedDateFrom: $salesCreatedDateFrom
salesCreatedDateTo: $salesCreatedDateTo
) {
_id
type
created
user {
type
name
email
ref
}
task {
path
name
}
options
optionsAsString
status
hidden
results {
uri
key
message
fileSizeString
fileSize
logs
}
completion
}
}
Variables
{
"type": "type",
"exportType": "listings",
"filters": {},
"filtersV2": {
"page": 1,
"limit": 20,
"stock": "stock",
"type": "type",
"itemTypes": [
"itemTypes"
],
"status": "status",
"discogsStatus": "discogsStatus",
"sort": "sort",
"order": -1,
"supplierCode": [
"supplierCode"
],
"suppliers": [
"suppliers"
],
"condition": [
"condition"
],
"secondHand": true,
"location": [
"location"
],
"locationSearch": "locationSearch",
"categories": [
"categories"
],
"itemId": "itemId",
"term": "term",
"from": "from",
"to": "to",
"dateFilter": "dateFilter",
"availableDate": [
1784728200202
],
"publishedDate": [
1772532073500
],
"createdDate": [
1767062830001
],
"preOrder": true,
"compareAtPrice": true,
"publicComment": true,
"privateComment": true,
"onePerCustomer": true,
"labels": [
"2f47cac8c8a9803a80071cc5"
],
"sleeveCondition": [
"sleeveCondition"
],
"hasSnippet": "hasSnippet",
"hasAudio": true,
"artists": [
"942c111e1a80d018482519ca"
],
"styles": [
"styles"
],
"genres": [
"genres"
],
"formatDescriptions": [
"formatDescriptions"
],
"formats": [
"formats"
],
"years": [
42
],
"listingRefs": [
"listingRefs"
],
"filteredIds": [
"21f9f87a856a212272286173"
],
"createdBy": "2f41939f8d7f66616089c9a0",
"countries": [
"Canada"
],
"manufacturers": [
"manufacturers"
],
"productTypes": [
"productTypes"
],
"giftCards": true
},
"salesPaymentDateFrom": 1771134694113,
"salesPaymentDateTo": 1755308491408,
"salesShippingDateFrom": 1750406417655,
"salesShippingDateTo": 1770903799963,
"salesCreatedDateFrom": 1768947326447,
"salesCreatedDateTo": 1763243895537
}
Response
{
"itemInventoryExport": {
"_id": "46057314fc7f0d9c8e6b6927",
"type": "example",
"created": 1775324128301,
"user": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "9160392d89b13faf1718ff8b"
},
"task": {
"path": "/release/1763553751/release-artist-release-name",
"name": "example"
},
"options": {},
"optionsAsString": "example",
"status": "pending",
"hidden": true,
"results": {
"uri": "https://www.my-common-ground-store.com/release/1763553751/release-artist-release-name",
"key": "example",
"message": "example",
"fileSizeString": "example",
"fileSize": 42,
"logs": [
"example"
]
},
"completion": 1.23
}
}
Arguments
| Name | Type | Description |
|---|---|---|
type ⚠️ | String | What to export, as a free string: "listings" ("inventory" is accepted too) or "sales". Replaced by exportType. ⚠️ Deprecated: Use exportType. |
exportType | InventoryExportType | What to export: listings (one row per listing) or sales (one row per order line). Required unless the deprecated type is given. |
filters | JSON | Filter criteria as a JSON object. This parameter is deprecated; use filtersV2 instead. |
filtersV2 | InventoryFilters | Comprehensive filter input for inventory queries. This is the preferred way to filter export results. |
salesPaymentDateFrom | Date | Start date for filtering sales by payment date. |
salesPaymentDateTo | Date | End date for filtering sales by payment date. |
salesShippingDateFrom | Date | Start date for filtering sales by the date the order was shipped or collected. |
salesShippingDateTo | Date | End date for filtering sales by the date the order was shipped or collected. |
salesCreatedDateFrom | Date | Start date for filtering sales by creation date. |
salesCreatedDateTo | Date | End date for filtering sales by creation date. |