deleteProduct

Version 2024-11-01

📘

Important

The Buy with Prime API is offered as a preview and might change as we receive feedback and iterate on the interfaces. We are sharing this early documentation to help you learn about the Buy with Prime API as we write and iterate on the content.

Overview

Delete a Product.

ℹī¸

Required scope(s)

View & Edit Catalog Data

Response

Return type DeleteProductResponse

Arguments

ArgumentDescription
identifier (ProductIdentifierInput)

Product identifiers to locate a product.

Examples


Delete Product By Sku

Request

mutation deleteProduct {
    deleteProduct(identifier: {
        sku: "example-sku"
    }) {
        id
    }
}

Response

{
  "data": {
    "deleteProduct": {
      "id": "abcdef01234567"
    }
  }
}

Delete Product By Product Id

Request

mutation deleteProduct {
    deleteProduct(identifier: {
        productId: "abcdef01234567"
    }) {
        id
    }
}

Response

{
  "data": {
    "deleteProduct": {
      "id": "abcdef01234567"
    }
  }
}

Delete Product By External Id

Request

mutation deleteProduct {
    deleteProduct(identifier: {
        externalId: "example-external-id"
    }) {
        id
    }
}

Response

{
  "data": {
    "deleteProduct": {
      "id": "abcdef01234567"
    }
  }
}

Delete Product By Amazon Sku

Request

mutation deleteProduct {
    deleteProduct(identifier: {
        amazonSku: { value: "example-amazon-sku" }
    }) {
        id
    }
}

Response

{
  "data": {
    "deleteProduct": {
      "id": "abcdef01234567"
    }
  }
}

Delete Product Does Not Exist

Request

mutation deleteProduct {
    deleteProduct(identifier: {
        productId: "abcdef01234567"
    }) {
        id
    }
}

Response

{
  "errors": [
    {
      "message": "Request references a resource which does not exist.",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "deleteProduct"
      ],
      "extensions": {
        "classification": {
          "type": "ResourceNotFoundError",
          "errorType": "ResourceNotFoundException",
          "errorCode": 404
        }
      }
    }
  ],
  "data": {
    "deleteProduct": null
  }
}