Create a service via Rancher API

I don’t know how can I create a service via Rancher API programmatically. Can you please give me an example? For example, creating a Nginx service.
Thanks.