Unsolved

1133

January 5th, 2021 08:00

Unisphere api for unity 480F - Trying to create a snapshot and it returns 400 Bad request

Hello,


I'm trying to create a snapshot of a smbshare and I'm using the underlying storageResource id associate with smb share to take a snapshot using rest api. And it doesn't seem to work from postman.

 

POST https://10.x.x.x/api/types/snap/instances   400  303 ms

Warning: Unable to verify the first certificate

POST /api/types/snap/instances HTTP/1.1
EMC-CSRF-TOKEN: xxxxxxxxxxxxxxxxx
X-EMC-REST-CLIENT: true
Accept: application/json
Content-Type: application/json
Authorization: Basic xxxxxxxxxxxxxxx
User-Agent: PostmanRuntime/7.26.8
Postman-Token: 40a20374-ba98-4be0-9f56-50beafe2dec4
Host: 10.40.30.14
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Cookie: MOD_AUTH_CAS_S=xxxxxxxxxxxx; mod_sec_emc=value2&xxxxxxxx&value1&xxxxxxxxxxxxxx%3D%0A&value3&1
Content-Length: 177
----------------------------postman
Content-Disposition: form-data; name="storageResource"

res_115
----------------------------postman--
HTTP/1.1 400 Bad Request
Date: Tue, 05 Jan 2021 15:56:54 GMT
Server: Apache
X-Frame-Options: SAMEORIGIN
Strict-Transport-Security: max-age=63072000; includeSubdomains;
EMC-CSRF-TOKEN: xxxxxxxxxxxxxxxxxxx
Pragma: no-cache
Cache-Control: no-cache, no-store, max-age=0
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Language: en-US
Connection: close
Transfer-Encoding: chunked
Content-Type: application/json; version=1.0;charset=UTF-8
{"error":{"errorCode":131150096,"httpStatusCode":400,"messages":[{"en-US":"Invalid request argument: [storageResource]. (Error Code:0x7d13110)"}],"created":"2021-01-05T15:56:54.181Z"}

I'm sure that I'm making a mistake, can someone help ? 

Moderator

 • 

7.7K 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.7K Posts

January 7th, 2021 17:00

Hello RajBarathTahngapandian,

What is your current OE environment?

No Events found!

Top