
Solved!
Go to SolutionM
mattdulson
4 Posts
0
13365
May 3rd, 2017 07:00
How can I use curl to interact with the Unity REST API
My issue is around getting authorization information.
"curl -k -X GET https://ipaddressofmyarray/api/types/basicSystemInfo/instances" works fine, because it does not need any authorization
I then tried:
curl -H "Accept:application/json" -H "Content-type:application/json" -H "X-EMC-REST-CLIENT:true" -H "Authorization:Basic XXXXXXXXXXXXXXXX" -k -X GET https://ipaddressofmyarray/api/types/system/instances?fields=name,model,serialNumber
Where XXXXXXXXXXXXXXXX is the Base64 encoding of "admin:myarraypassword"
I know that I need to get the EMC-CSRF-TOKEN/Ticket granting cookie but was expecting to get this with the first GET request I do - should I be using a different URL to do this initial authorization, or does any GET to a valid URL work?
I've seen perl and python examples, but as I am not familiar with either of these 2 languages, then this doesn't help me much.
The response I get is:
Found
The document has moved https://ipaddressofmyarray/cas/login?service=https%3a%2f%2fipaddressofmyarray%2fapi%2ftypes%2fsystem%2finstances%3ffields%3dname,model,serialNumber">here.
Matt
Responses (0)
Solutions (0)
