How to upload Zabbix template using API

Does anyone know, how to upload Zabbix templates using API? We are trying to use java and Zabbix 2.0 API. Our goal is to get Zabbix graphs (png pictures) by different hosts and to display them on ...