Programmatically create item with codeunit or page via web service


I want to programmatically create new item and variant with a codeunit or page via web service. Any one know how can I do it?.

I supose that If i expose the item page, i can add new item as i can do in sales or purchase order… same with the variants… It’s right?.

Can I do it exposing a codeunit as a web service and calling it with item name, variant name, cost and sell price as parameters?.

Thanks and best regards from Spain.

You can do it in both ways:

Personally I would prefer the second option.

Thanks!! Thats a great beginning!! I have to recode to php but I think there is all i need!.