Forum

This content is now out of date.

Visit Our Community

Import sub-categories by webservice

Hi !,

We have a requirement to create subcategories automatically using webservice. Therefore, I have been working on creating sub-categories using available webservice call "IMPORTCONTENT". I want to create new sub categories under already created main category. This can be done in manual import by replacing the main category and adding a sub-category.

I did import successfully without importOptions in the SOAP request.

I have attached the SOAP request and import XML file which I used for this experiment. Could you please advice me how importOptions should be changed in my SOAP request in order to create a sub-category under already created main category.

Thanks
Supun

Hi Supun,

You can use the following options to import the sub category from the xml file and attach it to an existing category:

[code]ImportOption[] options = new ImportOption[3];
// this option tells Yellowfin to ignore the Category in the xml file
options[0] = new ImportOption();
options[0].setItemIndex(0);
options[0].setOptionKey("SKIP");
options[0].setOptionValue("true");

// this option tells Yellowfin to import the Sub Category in the xml file
options[1] = new ImportOption();
options[1].setItemIndex(1);
options[1].setOptionKey("OPTION");
options[1].setOptionValue("ADD");

// this option tells Yellowfin to attach the Sub Category to an existing Category
options[2] = new ImportOption();
options[2].setItemIndex(1);
options[2].setOptionKey("CATEGORY");
options[2].setOptionValue("MYCAT");

request.setImportOptions(options);[/code]

Please note that the category in the third option ("MYCAT" in this example) must be the content category code for an existing category. You can find the category codes for existing categories in the ContentManagement table in the Yellowfin database.

Thanks,
Steve

Hi Steve,

Thank you for the reply. It works successfully with the given ImportOptions.

Regards
Supun