Create new product 'Case'?

Hi,
I found that API supports querying a product’s case, but is it possible to create a new Case and generate a new case_barcode?
Thank you!

Hey @Raj,

Thanks for reaching out!

You can create a new case and case barcode for a product by running a product_update mutation:

mutation {
  product_update(
    data: { sku: "pc2", cases: [{ case_barcode: "test2", case_quantity: 3 }] }
  ) {
    request_id
    complexity
    product {
      id
      legacy_id
      account_id
      name
      cases {
        case_barcode
        case_quantity
      }
    }
  }
}

You can also pass this field in the product_create mutation:

mutation {
  product_create(
    data: {
      name: "pc1"
      sku: "pc1"
      cases: [{ case_barcode: "test", case_quantity: 3 }]
      warehouse_products: [{ warehouse_id: "70405", on_hand: 0 }]
    }
  ) {
    request_id
    complexity
    product {
      id
      legacy_id
      account_id
      name
      sku
      cases {
        case_barcode
        case_quantity
      }
    }
  }
}```

Let me know if you have any questions or concerns.

Best,
RayanP
1 Like

Ah… I see - I was looking for something like case_create, but it’s supposed to work only as a subset of product - got it! Thank you @sh-agent!

1 Like

Hello @sh-agent !

I hope you’re doing well.
I’ll add a comment to this post due to an issue that I’m having while trying to create new cases using the product_update mutation.

When trying to update a product and create a case for it, this is the query I’m sending:

mutation($customer_account_id: String, $sku: String!, $case_barcode: String!, $case_quantity: Int!) {
  product_update(data: { 
    customer_account_id: $customer_account_id
    sku: $sku
    cases: [
      {
      case_barcode: $case_barcode
      case_quantity: $case_quantity
      }
    ]
  }) {
    request_id
    complexity
    product {
      id
      legacy_id
      account_id
      name
      sku
    }
  }
}

And this is the response:

{
  "errors": [
    {
      "message": "Cannot access the requested resource. Permission denied",
      "operation": "product_update",
      "field": "product_update",
      "request_id": "63f630709d26ef03a3bb0225",
      "code": 9
    }
  ],
  "data": {
    "product_update": null
  },
  "extensions": {
    "throttling": {
      "estimated_complexity": 10,
      "cost": 10,
      "cost_detail": {
        "product_update": {
          "items_count": 0,
          "cost": 10,
          "total_cost": 10,
          "fields": {}
        }
      },
      "user_quota": {
        "credits_remaining": 1988,
        "max_available": 2002,
        "increment_rate": 30
      }
    }
  }
}

It only happens when trying to update anything related to cases (my account has admin permissions). If I update any other attribute of the product, I can update them without any further issue if I don’t include anything related to cases.

Is there anything that I may be missing?
Thanks
Cristóbal

Hey @cmora!

Thanks for hanging in there!

Would you mind sending the full request for this call to me privately? I’d like to take a closer look at the headers, and variables on your end if possible.

Please let me know if you have any questions or concerns.

Best,
RayanP

Hi!

We are getting the same error. If I remove the cases attribute the mutation works fine, but if I add them then it throws the permission denied error.

Thanks