Create host or hostgroup from my plugin

Hi everyone !!

My question will sound a bit stupid but i don't know how to call the
method create Host or hostgroup with new fields from my new plugin ? all i
know is with name and when i add fields value like operating_system id it
doesn't' appears on foreman UI ?

Thanks in advance for you help