According to the api documentation of item creation you need to provide a hostid and templateid is read only ( https://www.zabbix.com/documentation/2.2/manual/api/reference/item/object )
Which would mean that you can't link an item that you are creating to a certain template through the api. However you can provide the hostid parameter with a template param which isn't documented (clearly) in the api documentation.