This post is more than 5 years old
17 Posts
0
3429
XtremIO RestAPI version 4.0.2 build 80 Post command for snapshot creation not working
I am trying to create a snapshot of a consistency group in XtremIO using CURL. Unfortunately it fails stating it requires cluster-id even though I have mentioned cluster-name in the command. Can some one help me on what's going on wrong here?
XIO - version 4.0.2 build 80
curl -X POST -d '{"consistency-group-id":"Test_Group"}' -u *****:****** -k -s https://test.com/api/json/v2/tyes/snapshots?cluster-name="test"
{
"message": "cluster_id_is_required",
"error_code": 400
}
Please note - The CG was already created and it has multiple snapshot-sets already available.
mabela
33 Posts
0
October 3rd, 2016 12:00
I just tried both using POSTMAN and curl and could get it to work. I did notice that the name is case sensitive (originally i entered marco_set and it didn't find it), so maybe try this?
Below is what i tried:
Curl:
curl -k "https://username:PW@XMS_IP/api/json/v2/types/snapshot-sets?name=Marco_SET&cluster-name=myxbrick01" -X DELETE
POSTMAN:
DELETE https://XMS_IP/api/json/v2/types/snapshot-sets?name=Marco_SET&cluster-name=myxbrick01
mabela
33 Posts
1
October 3rd, 2016 06:00
Hi erin1982$,
Can you try specifying "cluster-id" in the body rather than in the URL?
So your REST API call would be:
curl -X POST -d '{"consistency-group-id":"Test_Group", "cluster-id":test"}' -u *****:****** -k -s https://test.com/api/json/v2/tyes/snapshots
I think this should work, but i dont currently have a multi-cluster environment to test.
Please let me know.
erin1982_
17 Posts
0
October 3rd, 2016 08:00
Thank you Mabela. It worked perfectly. But I am struggling now to delete a snapshot-set. Bash is not accepting the cluster-name which is coming after "&"
curl -X DELETE -u ****:**** -k -s /api/json/v2/types/snapshot-sets?name=SnapshotSet.1475076959480&cluster-name=test
[1] 22014
-bash: cluster-name=test: command not found
erin1982_
17 Posts
0
October 4th, 2016 05:00
Mabela,
Thank you so much . I was able to execute the DELETE command and finished the scripting work.
Yesterday I didn't use the "" for the URL .
Regards,
Jerin
erin1982_
17 Posts
0
October 20th, 2016 06:00
I am receiving the following error, when I try to do snapshot refresh. Could you please let me know what could be wrong here? I am sure this is the right cluster-id
curl -X PUT -d '{"cluster-id":2,"new-name":"SNAP_TEST_CHECK-old"}' -u ***:*** -k -s https://test.com/api/json/v2/types/snapshot-sets?name=SNAP_TEST_CHECK
{
"message": "Command Syntax Error: Invalid property cluster-id",
"error_code": 400
}
mabela
33 Posts
1
October 20th, 2016 10:00
I tried the below with POSTMAN and it worked, but i am not using multi cluster. Do you have multiple clusters deployed to XMS? If so, can you try using the name of the cluster instead of the #:
https://XMS_IP/api/json/v2/types/snapshot-sets/15
{"new-name":"RENAME"}
huj1
15 Posts
1
October 20th, 2016 15:00
It's not working so good in 4.0.2-80, could you please put the cluster-index in the url instead?
# curl -s -k -X PUT -d '{"new-name":"RestTestName"}' https://username:password@xmsip/api/json/v2/types/snapshot-sets/?name=resttest\&cluster-index=1
erin1982_
17 Posts
0
October 21st, 2016 07:00
Thank you. Yes our XMS manages multiple clusters.
erin1982_
17 Posts
0
October 21st, 2016 07:00
Thank you. It worked when I used the cluster index in the url instead of cluster-id in the data section.
I was able to rename the old snapshot and do a refresh. Currently working on capturing the error code so that can pass it another script to generate tickets.
curl -s -k -X PUT -d '{"new-name":"'"$newsnapname"'"}' -u ***:**** https://xms.com/api/json/v2/types/snapshot-sets?name=SNAP_TEST_CHECK\&cluster-index=2
curl -s -k -X POST -d '{"cluster-id":2,"from-consistency-group-id":"Test_Group","to-snapshot-set-id":"'"$newsnapname"'","snapshot-set-name":"SNAP_TEST_CHECK"}' -u ****:***** https://xms.com/api/json/v2/types/snapshots