erin1982_
1 Copper

XtremIO RestAPI version 4.0.2 build 80 Post command for snapshot creation not working

Jump to solution

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.

0 Kudos
1 Solution

Accepted Solutions
mabela
2 Bronze

Re: XtremIO RestAPI version 4.0.2 build 80 Post command for snapshot creation not working

Jump to solution

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

View solution in original post

0 Kudos
9 Replies
mabela
2 Bronze

Re: XtremIO RestAPI version 4.0.2 build 80 Post command for snapshot creation not working

Jump to solution

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.

Highlighted
erin1982_
1 Copper

Re: XtremIO RestAPI version 4.0.2 build 80 Post command for snapshot creation not working

Jump to solution

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

0 Kudos
mabela
2 Bronze

Re: XtremIO RestAPI version 4.0.2 build 80 Post command for snapshot creation not working

Jump to solution

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

View solution in original post

0 Kudos
erin1982_
1 Copper

Re: XtremIO RestAPI version 4.0.2 build 80 Post command for snapshot creation not working

Jump to solution

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

0 Kudos
erin1982_
1 Copper

Re: XtremIO RestAPI version 4.0.2 build 80 Post command for snapshot creation not working

Jump to solution

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

}

0 Kudos
mabela
2 Bronze

Re: XtremIO RestAPI version 4.0.2 build 80 Post command for snapshot creation not working

Jump to solution

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
1 Copper

Re: XtremIO RestAPI version 4.0.2 build 80 Post command for snapshot creation not working

Jump to solution

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_
1 Copper

Re: XtremIO RestAPI version 4.0.2 build 80 Post command for snapshot creation not working

Jump to solution

Thank you. Yes our XMS manages multiple clusters.

0 Kudos
erin1982_
1 Copper

Re: XtremIO RestAPI version 4.0.2 build 80 Post command for snapshot creation not working

Jump to solution

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

0 Kudos