Upgrade Service via CI


I have Jenkins job, which builds a container from repository and push it to DockerHub.
docker build -t example/api:latest .
docker push example/api:latest

I want to create another Jenkins job, which will upgrade specific service with latest container .
Right now I manually click “Edit” on Service in Rancher, in Docker Image field it has “example/api:latest” and then I just click “Upgrade”.

How could I automate it?