UNSOLVED

GKG12345

updated

11 years ago

G

GKG12345

21 Posts

0

1484

October 26th, 2015 04:00

REST API to enable image access

I'm trying to use the REST API to enable image access

To prototype the calls I'm using powershell - plan to turn into c# once we know the command sequence we need.

I can find the snapshot using snapshots_for_time_and_date and get the id of the snapshot. When I try to use this to enable image access mode I get an error.

PS C:\htape\sn\cmd> Invoke-WebRequest -method post -Credential $credential -uri HTTPS://10.1.30.85/fapi/rest/4_0/settings/groups/659407330/copies/644881254048673798/1/actions/enable_image_access

-body "{""snapshot"":{""snapshotUID""{""id"":766629494}},""mode"":""LoggedAccess"",""scenario"":""Unknown""}"

-headers @{Accept="application/json";"Content-Type"="application/json"}

Invoke-WebRequest : The remote server returned an error: (500) Internal Server Error.

At line:1 char:1

+ Invoke-WebRequest -method post -Credential $credential -uri HTTPS://172.17.30.85 ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException

    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

I'm guessing I missed something in the formatting of the JSON or something but I'd really appreciate it if anyone can spot what I've missed.

I know I could use invoke_RestMethod but the results are the same.