How To Change Resource Status Via API


This article talks about how to change the status of a resource.

Note that you can not make a direct post to the resource endpoint to change the status. Otherwise, you will run into this error:

"requests. exceptions.HTTPError: 405 Client Error: Method Not Allowed for URL:


To change the status of a resource from Active to Historical or vice versa via API, create a Resource Action that would handle updating the status of the resource. Then, execute the resource action from https://[yourcbdomain]/api/v3/cmp/resourceActions/


Step 1 Add A resource Action

  1. As an admin, navigate to Admin -> Resource Actions → Add New action type CB Plug-in.

  2. In the code add:

    def run(job, *args, **kwargs):
    r = kwargs.get('resource')
    set_progress("Status of this resource is : {}".format(r.lifecycle))
    r.lifecycle = 'Historical'
    return "SUCCESS", "Status Changed Successfully", ""

Step 2 Execute the Action:

  1. Make a post call to https://[yourcbdomain]/api/v3/cmp/resourceActions/

Additional information!cloudbolt-latest-docs/cloudbolt-api-v3

Have more questions? Submit a request


Please sign in to leave a comment.