0

when i try to call the REST API categoryrepositoryV1 with SOAPUI to create a category (With POST) it says my id doesn't exist.

{
  "category": {
    "id" : "16",
    "parentId": 13,
    "name": "Regulateur A127 en ligne, compact",
    "isActive": true,
    "position": 1,
    "level": 3,
    "include_in_menu": true,
    "path" : "1/3/13/16"
    }
}

but if I try without and ID , it creates my category.

When I checked where is the error when i try to create my category with and ID , it is because of line 87/88 in vendor/magento/catalog/model/categoryRepository.

it's : $category = $this->get($category->getId(), $storeId);

enter image description here

I comment it in my screenshot.

Why does he try to get the id of the category i'am creating ?

How can I make it work ?

Thanks for your help.

0

Remove id from post parameter & use the below code & check Parent Id as well i have Parent id 1 So its working for me in your case you are using 13 So check it exist or not . Why i removed id from post parameter means its auto generated so need to provided id

{ "category": { "parentId": 1, "name": "Regulateur A127 en ligne, compact", "isActive": true, "position": 1, "level": 3, "include_in_menu": true, "path" : "1/3/13/16" } }

  • I need to provide my own ID , that's why i'am here , I don't want to use an auto generated id – Killian Sep 29 '16 at 9:21
  • then check your last created id in category section & provided incremented one use below paramenters { "category": { "id": 4, "parentId": 1, "name": "Regulateur A127 en ligne, compact", "isActive": true, "position": 1, "level": 3, "include_in_menu": true, "path" : "1/3/13/16" } } – Brad Hodge Sep 29 '16 at 9:32
  • I need my id to be a specific number , not an incremented one – Killian Sep 29 '16 at 9:38
  • on that case you have to with Custom Api Override the Core Api – Brad Hodge Sep 29 '16 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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