Unsolved
This post is more than 5 years old
21 Posts
0
1427
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.
forshr
1.1K Posts
0
October 27th, 2015 11:00
Can you confirm if the IP address is the cluster/floating IP address of the RP cluster?
GKG12345
21 Posts
0
October 28th, 2015 02:00
The other calls work... I've obtained the group details, I've created a bookmark, I've got details (the Id) of the bookmark with settings/groups/ /copies/ / /snapshots_for_time_and_date - so clearly I am talking to something at seems to work, but do I need to talk to the remote RPA to enable the bookmark rather than just specifying the Cluster/copy that I got from the snapshots_for_time_and_date rather than doing everything talking to the same IP address?
forshr
1.1K Posts
0
October 29th, 2015 07:00
You need to use the cluster/management IP address or the IP address for either RPA1 or 2 when using REST API calls.
Re your last e-mail, I can see a mistype of cluster id.
Idan
675 Posts
0
October 29th, 2015 07:00
Hi there,
You can run the image access from the either clusters. Also, cluster and copy are required in all cases.
Regards,
Idan Kentor
@IdanKentor
GKG12345
21 Posts
0
October 29th, 2015 10:00
Looks like the correct answer is that description and closingTimestamp and required on the snapshot. Had been using powershell, but now using curl to prototype as much easier to diagnose.