Archiving Products
Inside this guide:
Introduction
Archive a Product
Next steps
Introduction
The archiveCoreProduct mutation allows you to archive a Product.
Archive a product
Constructing the mutation and input
We'll be using the API Console to save time having to authenticate. Copy and paste this into your API console query section to get started. Reminder that fields can be removed from the query if you don't want the API to return them.
POST /graphql
Query
mutation ($input: ArchiveCoreProductInput!) {
archiveCoreProduct(input: $input) {
product {
id
name
skuCode
barcode
category {
id
name
}
dimensions {
width
height
length
unit
}
weight {
value
unit
}
unitsPerCarton
cbmPerUnit
characteristics {
hot
hazardous
specialHandling
refrigerated
stackable
garmentsOnHangers
healthCertificate
riskLevel
}
attributes {
attribute {
id
name
type
}
value
}
tariffCodes {
tariffCode
tariffRegionCode
}
sellCostPrices {
sellCostPrice {
value
currency
}
mainPrice
}
buyCostPrices {
buyCostPrice {
value
currency
}
manufacturer {
id
}
mainPrice
}
status
}
errors {
path
message
}
}
}
Defining the variables
Copy and paste the block below into the query variables section of the API console and substitute the PRODUCT_ID with the product id you want to archive.
Variables
{
"id": PRODUCT_ID
}
Now press Execute Query (the play button) to send the request.
You should get back this response containing all the requested product data of the id you provided.
NOTE: The various ids e.g. product id and category id will not match what you get back in the actual response.
JSON Response
{
"data": {
"archiveCoreProduct": {
"product": {
"id": "cfeeb6ee-91c4-46b1-9411-71185d359324",
"name": "Blue T-Shirts",
"skuCode": "10000",
"barcode": "J48fFJ3811",
"category": {
"id": "b426b1d7-6210-4cd1-ac65-b3dc184c473b",
"name": "Clothes"
},
"dimensions": {
"width": 5,
"height": 10,
"length": 20,
"unit": "CM"
},
"weight": {
"unit": "G",
"value": 100
},
"unitsPerCarton": 5,
"cbmPerUnit": 100,
"characteristics": {
"hot": false,
"hazardous": false,
"specialHandling": false,
"refrigerated": false,
"stackable": true,
"garmentsOnHangers": false,
"healthCertificate": false,
"riskLevel": "LOW"
},
"attributes": [
{
"attribute": {
"id": "b6e596dd-203b-4867-a553-b782d5b0ea10",
"name": "Colour",
"type": "TEXT"
},
"value": "Blue"
}
],
"tariffCodes": [
{
"tariffRegionCode": "GB",
"tariffCode": "12345678"
}
],
"sellCostPrices": [
{
"sellCostPrice": {
"value": 5,
"currency": "GBP"
},
"mainPrice": true
}
],
"buyCostPrices": [
{
"buyCostPrice": {
"value": 5,
"currency": "GBP"
},
"manufacturer": {
"id": "b426b1d7-6210-4cd1-ac65-b3dc184c473b"
},
"mainPrice": true
}
],
"status": "ACTIVE"
},
"errors": null
}
}
}
This will result in the product you archived no longer being searchable using coreProduct query or editable using updateCoreProduct query.
Next Steps
- Create Product - Learn how to create a product
- Query Product - Learn how to query a product
- Update Product - Learn how to update a product
- Archive Product - Learn how to archive a product
- Unarchive Product - Learn how to unarchive a product
- Making your first call - If you're not sure how GraphQL works, start here.