Updating workload

Information about the workload can be updated by sending a PATCH request to the /api/workload_management/v5/workloads/{workload_id} endpoint.

Request structure


Value type




A name of the workload.



A key-value map of workload attributes. Allowed values are defined by the attributes schema specified in the Vendor Portal.



An identifier of the API client that created the workload. Must be the client ID of your application.


array of string

A list of workload action identifiers that are allowed for this workload.



Status of the workload. True if enabled, false otherwise.

Example of the workload update payload:

    "name": "New virtual machine name",
    "attributes": {
        "hostname": "CORP-123456",
        "mac_address": "0a:df:7e:25:36:7e"

Response structure

If the workload was updated successfully, the response returns status 204 without payload.

Step-by-step procedure

  1. Authenticate to the cloud platform via the Python shell.

    The following variables should be available now:

    >>> base_url  # the base URL
    >>> auth  # the 'Authorization' header value with the access token
    {'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6ImMwMD...'}
  2. Define a variable named workload_id, and then assign ID of the workload obtained from the list of fetched workloads to this variable:

    >>> workload_id = 'b369335d-fc8a-4c7f-b5bb-896448c854bd'
  3. Define a variable named workload_data, and then assign the updated information about the workload to this variable:

    >>> workload_data = {
    ...     "name": "New virtual machine name",
    ...     "attributes": {
    ...         "hostname": "CORP-123456",
    ...         "mac_address": "0a:df:7e:25:36:7e"
    ...     }
    ... }
  4. Convert the workload_data object to a JSON text:

    >>> workload_data = json.dumps(workload_data, indent=4)
    >>> print(workload_data)
        "name": "New virtual machine name",
        "attributes": {
            "hostname": "CORP-123456",
            "mac_address": "0a:df:7e:25:36:7e"
  5. Send a PATCH request with the JSON text to the /api/workload_management/v5/workloads/{workload_id} endpoint:

    >>> response = requests.patch(
    ...     f'{base_url}/api/workload_management/v5/workloads/{workload_id}',
    ...     headers={'Content-Type': 'application/json', **auth},
    ...     data=workload_data,
    ... )
  6. Check the status code of the response:

    >>> response.status_code

    Status code 204 means that the workload was updated successfully.