magentomagento-soap-api

Create Magento category with assigned id using SOAP api


I am working on a script (which is in Python) for doing some management on our Magento environment.
Now I am wondering if I can create categories with assigned ID. I think this might be impossible due to key constraints. But is there a way?
Just putting category_id in the parameter list in catalog_category.create, it does not work, it just skips the parameter.
The main reason of wanting this is because I need to know the category ID in order to create the subcategories.
I do know the Magento API returns the ID of the created category.
But, I have no way of knowing what subcategories are supposed to go to that created category.
(Or I can rewrite a load of code, which I am not too fond of...).
So I was thinking this was the easiest way to go with right now.
Any suggestions, comments, answers? Anything is appreciated!


Solution

  • No, you can't. Magento's entity IDs are for Magento so you cannot specify what you'd like them to be.

    When you create an entity with the API it will return the new ID, as you've said.

    For your use case it might be easiest to add a new attribute to your categories in Magento, call it "my_category_id" or something and allow your API to set that instead.