Restore Resources from Trash

PUT

This API restores resources that were previously moved to the Trash in PAM360. You need to provide the list of trash IDs that should be restored. The response confirms whether the resources were successfully restored.

Request URL

https://<Hostname-or-IP-address-of-PAM360-server>:<Port>/restapi/json/v1/trash/restore 

Header Parameters

{
"AUTHTOKEN" : "<<Authtoken-generated-from-PAM360>>",
"orgName"   : "<<org display name>>"
}

ParameterDescriptionValues

AUTHTOKEN

Authentication token for the user to authorize the API request.
Type : String
Mandatory : Yes

Default Value : N/A

orgName

Organization name available in PAM360.
Type : String
Mandatory : No

Default Value : The organization to which the user belongs.

Body Parameters

INPUT_DATA={
"operation": {
	"Details": {
	"type": "resource",
	"trashIds": [1,2]
		}
	}
}

ParametersDescriptionValues

type

Specifies the object type to be restored.
Type : String
Mandatory : Yes

Default Value : resource
Allowed Values : resource, account

trashIds

List of resource IDs to be restored from trash.
Type : Integer Array
Mandatory : Yes

Default Value : N/A

Sample Request

cURLPythonPowerShell
curl -X PUT -H "Content-Type: application/x-www-form-urlencoded" -H "AUTHTOKEN: <<Authtoken-generated-from-PAM360>>" https://<Host-Name or IP-Address-of-PAM360-Server>:<Port>/restapi/json/v1/trash/restore --data-urlencode "INPUT_DATA={\"operation\":{\"Details\":{\"type\":\"resource\",\"trashIds\":[12]}}}"
import requests
import urllib.parse

# URL
url = "https://<Host-Name or IP-Address-of-PAM360-Server>:<Port>/restapi/json/v1/trash/restore"

# Headers
headers = {
	"Content-Type": "application/x-www-form-urlencoded",
	"AUTHTOKEN": "<<Authtoken-generated-from-PAM360>>"
}

# Query params (INPUT_DATA)
params = {
	"INPUT_DATA": {
	"operation": {
		"Details": {
			"type": "resource",
			"trashIds": [6]
		}
	}
}
}

# Encode params into query string
query_string = urllib.parse.urlencode(params)
final_url = f"{url}?{query_string}"

# Send PUT request
response = requests.put(final_url, headers=headers, verify=True)

# Print only the API response body
print(response.text)
# URL
$Url = "https://<Host-Name or IP-Address-of-PAM360-Server>:<Port>/restapi/json/v1/trash/restore"

# Headers
$headers = @{
	"Content-Type" = "application/x-www-form-urlencoded"
	"AUTHTOKEN" = "<<Authtoken-generated-from-PAM360>>"
}

# Query params (INPUT_DATA)
$params = @{
	"INPUT_DATA" = '{ "operation": { "Details": {
		"type": "resource",
		"trashIds": [6]
	} } }'
}

# Add query params to URL
$queryString = ($params.GetEnumerator() | ForEach-Object { "$($_.Key)=$([uri]::EscapeDataString($_.Value))" }) -join "&"
$finalUrl = "$Url`?$queryString"

# Invoke PUT request
$response = Invoke-WebRequest -Uri $finalUrl -Method Put -Headers $headers

# Print only the API response body
$response.Content

Sample Response

{
  "operation": {
    "result": {
      "message": "Resource(s) restored successfully",
      "status": "Success",
      "statusCode": 20000
    },
    "name": "RESTORE"
  }
}



Top