Dell EMC Unity - How To Use cURL To Interact With Unity REST API (User Correctable) - Dell Singapore
Dell EMC Unity - How To Use cURL To Interact With Unity REST API (User Correctable) - Dell Singapore
Article Content
Instructions
The article describes the following actions through REST API with cURL commands:
1. Logging into the Unisphere Management REST API server.
2. Querying an existing LUN information.
3. Creating a new LUN.
4. Resizing the newly created LUN.
5. Querying the resized LUN.
6. Deleting that LUN.
7. Logging out of the Unisphere Management REST API server.
Result ==>
{"@base":"https://10.32.106.115/api/types/loginSessionInfo/instances?per_page=2000","updated":"2017-04-
12T02:50:20.921Z","links":[{"rel":"self","href":"&page=1"}],"entries":
[{"@base":"https://10.32.106.115/api/instances/loginSessionInfo","updated":"2017-04-12T02:50:20.921Z","links":
[{"rel":"self","href":"/admin"}],"content":{"id":"admin","roles":[{"id":"administrator"}],"user":
{"id":"user_admin"},"idleTimeout":3600,"isPasswordChangeRequired":false}}]}02:50:20 service@VIRT170979R20E-spa spa:~>
https://www.dell.com/support/kbdoc/en-sg/article/lkbprint?ArticleNumber=000009634&AccessLevel=30&Lang=en 1/4
10/28/22, 11:57 AM Dell EMC Unity: How To Use cURL to interact with Unity REST API (User Correctable) | Dell Singapore
Result ==>
{"@base":"https://10.32.106.115/api/instances/lun","updated":"2017-04-12T02:50:55.914Z","links":[{"rel":"self","href":"/sv_7"}],"content":
{"id":"sv_7","name":"DR_Rep_test_Des","sizeTotal":1073741824}}02:50:55 service@VIRT170979R20E-spa spa:~>
Result ==>
{"@base":"https://10.32.106.115/api/types/storageResource/action/createLun","updated":"2017-04-12T02:51:51.120Z","links":
[{"rel":"self","href":"/sv_19"}],"content":{"storageResource":{"id":"sv_19"}}}02:51:51 service@VIRT170979R20E-spa spa:~>
Result ==>
HTTP/1.1 204 No Content (because there is no output in the content of the HTTP response of the above request)
Result ==>
{"@base":"https://10.32.106.115/api/instances/lun","updated":"2017-04-12T02:54:05.763Z","links":
[{"rel":"self","href":"/sv_19"}],"content":{"id":"sv_19","name":"curlLUN","sizeTotal":1717987328}}02:54:05 service@VIRT170979R20E-spa
spa:~>
Result ==>
HTTP/1.1 204 No Content
Result ==>
Logout successful
Additional Information
Explanation about the cURL parameters.
X-EMC-REST-CLIENT: true
This tells the server to use the HTTP Basic access authentication mechanism to authenticate the login request.
EMC-CSRF-TOKEN
https://www.dell.com/support/kbdoc/en-sg/article/lkbprint?ArticleNumber=000009634&AccessLevel=30&Lang=en 2/4
10/28/22, 11:57 AM Dell EMC Unity: How To Use cURL to interact with Unity REST API (User Correctable) | Dell Singapore
-u "admin:P@ssw0rd"
Passing the username and password to REST API server for authentication in the login request.
-verbose
Verbose output of the communication process. Useful to retrieve the EMC-CSRF-TOKEN from the login command output.
Also useful when there is error of the command to have debug level information.
-H "Accept: application/json"
To indicate that the format of the response content is JSON.
-H "Content-type: application/json"
To indicate that the format of the request contains body is JSON; required if there is a request body.
-c cookies1.txt
Set the cookies file name to record cookies information.
-b cookies1.txt
Get the cookies information from previously saved cookies file.
-L
Necessary when there is URI redirection (HTTP 302). The command will resend the parameters to redirected URI.
-d '{"name":"curlLUN","lunParameters":{"pool":{"id":"pool_2"},"isThinEnabl ed":"false","size":"1073741824"}}'
curl data format to fit into JSON data structure
-k
Ignore the SSL certificate verification.
This option explicitly allows curl to perform "insecure" SSL connections and transfers.
Any further question, please refer to the attached Unity REST API programmer guide.
Attachments
REST_API_guide_csp_en_US_1.pdf
Article Properties
Affected Product
Dell EMC Unity Family
Product
Dell EMC Unity Family |Dell EMC Unity All Flash, Dell EMC Unity Family, Dell EMC Unity Hybrid, Dell EMC UnityVSA (Virtual Storage
Appliance)
Version
2
Article Type
How To
https://www.dell.com/support/kbdoc/en-sg/article/lkbprint?ArticleNumber=000009634&AccessLevel=30&Lang=en 3/4
10/28/22, 11:57 AM Dell EMC Unity: How To Use cURL to interact with Unity REST API (User Correctable) | Dell Singapore
https://www.dell.com/support/kbdoc/en-sg/article/lkbprint?ArticleNumber=000009634&AccessLevel=30&Lang=en 4/4