Moderator

 • 

7.8K Posts

January 5th, 2021 17:00

Hello RajBarathTahngapandian,

Are you using the Rest API programmers guide?  If not here is a link to the guide as well as the link to the reference guide.  https://dell.to/3okI1nM

 

https://dell.to/3okHVwq

January 7th, 2021 06:00

Yes. I'm using the guide. This is the script that I'm using

 

 

 

function CreateSnapshot($FilesystemName) {
    $url = $base_uri + 'api/types/storageResource/instances?fields=name&compact=true' 
    $response = Invoke-WebRequest -Uri $url -Headers $headers -Method Get -WebSession $session    
    $result = $response | ConvertFrom-Json
    $filesystem = $result.entries.content | Where-Object { $_.name -eq $FilesystemName  }
    Write-Output $filesystem 
    $name = $Filesystem.name + '_' +  $date_tday
    $body = @{
        "isReadOnly" = "false";
        "isAutoDelete" = "false";
        "isRemoteAutoDelete" = "false";
        "name" = "$($name)";
        "storageResource" = "$($filesystem.id)";
   }  | ConvertTo-Json
    if ( $filesystem.id ) {
        #Write-Host "Snapshot is about to be triggered for filesystem with ID $($filesystem.id) and name $($filesystem.name)"
        $headers.Add('Accept', 'application/json') 
        $headers.Add('EMC-CSRF-TOKEN', $response.Headers['EMC-CSRF-TOKEN'])
        $url = $base_uri + 'api/types/snap/instances'
        try {
            $resp = Invoke-WebRequest -Uri $url -Headers $headers -Method POST -WebSession $session -Body $body
        }
        catch {
            $_.Exception.Message
        }
    }
}

 

 

 

 

Moderator

 • 

7.8K Posts

January 7th, 2021 17:00

Hello RajBarathTahngapandian,

What is your current OE environment?

No Events found!

Top