0

Unable to create a new Tax Class using POST call end point -> http://magentohost/rest/default/V1/taxClasses

While creating a new Tax class using API /V1/taxClasses under taxTaxClassRepositoryV1 from the link http://devdocs.magento.com/swagger/index.html#/

The request which I am sending has a header with Content-Type and Authorization and body as below in JSON format,

{ "taxClass": { "class_id": 6, "class_name": "newcustomer", "class_type": "CUSTOMER", "extension_attributes": {} } }

The response which I get is

{
  "message": "No such entity with %fieldName = %fieldValue",
  "parameters": {
  "fieldName": "class_id",
  "fieldValue": 6
  }
}

1 Answer 1

0

I don't believe you can manually specify the class_id when creating a new tax class. The existence of a class_id will make the repositories save method attempt to load an entity with that ID and update it. If you remove the class_id field from you're request, I believe it will work.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.