Deploy Workload via REST API Example

I would like to deploy a workload on Rancher 2.x using the REST API. Can anyone share a working example for this?


Hi, did you find a solution to this? I’m sure others are curious too.

I’m ideally looking to deploy helm charts, but not sure if this is best done over the REST API or simply using a helm client sdk on my application side.

Hi, sorry so far I haven’t found a solution although the Rancher team did offer to submit the question for the last Rancher training with Jason van Brackel, I have yet to review the training video to see if it’s been answered. If not I was planning to use web UI or Rancher CLI to submit tasks and capture the network communications to the Rancher Server to work out the REST API calls. If I’m successful with this I will post the results over the coming week. Hope this helps.

Hey, thanks for the reply. Yeah i’ve been successful with the UI, think i’ll do the same, investigate network logs and unpick it! Will try to document this for anyone else who is interested.

Thanks :slight_smile:

1 Like

Hi antwan2093,

Did you have any luck figuring out how to update workloads via the Rancher 2 REST API?

This python script works for me:

import requests

ACCESS_KEY = 'apiAccessKey'
ACCESS_SECRET = 'apiAccessSecret'
config = {
    "containers": [{
        "imagePullPolicy": "IfNotPresent",
        "image": "nginx",
        "name": "nginx-test",
    "namespaceId": "test-namespace",
    "name": "nginx-test"
}'', json=config, auth=(ACCESS_KEY, ACCESS_SECRET)
1 Like