Skip to main content
  • Place orders quickly and easily
  • View orders and track your shipping status
  • Enjoy members-only rewards and discounts
  • Create and access a list of your products
  • Manage your Dell EMC sites, products, and product-level contacts using Company Administration.

PowerStore:管理 REST API 会话

Summary: 如何获取令牌以传递给多个 REST API 查询。

This article may have been automatically translated. If you have any feedback regarding its quality, please let us know using the form at the bottom of this page.

Article Content


Instructions

启动新的登录会话:
curl -k -s -X GET -H "Accept: application/json" -H "Content-type: application/json" -u admin -c mycookie.txt -verbose -L  https://10.20.30.40:443/api/rest/login_session


此处显示部分输出。系统会提示您输入密码:
curl -k -s -X GET -H "Accept: application/json" -H "Content-type: application/json" -u admin -c mycookie.txt -verbose -L  https://10.20.30.40:443/api/rest/login_session
Enter host password for user 'admin':
*   Trying 10.20.30.40...
* TCP_NODELAY set
* Connected to 10.20.30.40 (10.20.30.40) port 443 (#0)

. . . 
. . .

< HTTP/1.1 200 OK
< DELL-EMC-TOKEN: Zbn8/pfw/VhLXc+a9YQqtrp9cC0lUZKBPXKTl68KGNE=
< Content-Type: application/json

. . .
. . . 

* Connection #0 to host 10.20.30.40 left intact
[{"id":"fd406a0e-a82c-46d6-b31b-5bfa31a543ef"}]


或者,也可以通过交互方式传递密码:
curl -k -s -X GET -H "Accept: application/json" -H "Content-type: application/json" -u admin:password -c mycookie.txt -verbose -L  https://10.20.30.40:443/api/rest/login_session

使用上面获取的令牌并保持 cookie 文件名一致,REST API 查询现在可以作为单个会话运行,而无需进一步的身份验证。

 

示例

提醒:如果使用 curl for windows 或未安装 jq,则可以从这些示例中删除“| jq”。
 

列出设备详细信息

curl -k -s -X GET -H "DELL-EMC-TOKEN: Zbn8/pfw/VhLXc+a9YQqtrp9cC0lUZKBPXKTl68KGNE="  -H "Accept: application/json" -H "Content-type: application/json" -b mycookie.txt -L https://10.20.30.40:443/api/rest/appliance?select=* | jq
[
  {
    "id": "A1",
    "name": "PowerLoki-appliance-1",
    "service_tag": "ABC1234",
    "express_service_code": "123456789",
    "model": "PowerStore 7000T",
    "drive_failure_tolerance_level": "Single",
    "drive_failure_tolerance_level_l10n": "Single"
  }
]
 

列出本地用户

请注意,使用 ?select=id,name,role_id 选择三个特定列:
curl -k -s -X GET -H "accept: application/json" -H "Content-Type: application/json" -H "DELL-EMC-TOKEN: Zbn8/pfw/VhLXc+a9YQqtrp9cC0lUZKBPXKTl68KGNE=" -b mycookie.txt -L  https://10.20.30.40/api/rest/local_user?select=id,name,role_id | jq
 

列出 IP

请注意,使用通配符选择所有列:
curl -k -s -X GET -H "DELL-EMC-TOKEN: Zbn8/pfw/VhLXc+a9YQqtrp9cC0lUZKBPXKTl68KGNE="  -H "Accept: application/json" -H "Content-type: application/json" -b mycookie.txt -L https://10.20.30.40:443/api/rest/ip_pool_address?select=* | jq
 

生成指标

此示例是 POST 命令,需要正文来指定要收集的指标,格式为:-d '{ "entity": "performance_metrics_by_appliance", "entity_id": "A1", "interval": "Twenty_Sec"}':
curl -k -s -X POST -H "accept: application/json" -H "Content-Type: application/json" -H "DELL-EMC-TOKEN: Zbn8/pfw/VhLXc+a9YQqtrp9cC0lUZKBPXKTl68KGNE=" -b mycookie.txt -L -d '{ "entity": "performance_metrics_by_appliance", "entity_id": "A1", "interval": "Twenty_Sec"}' https://10.20.30.40/api/rest/metrics/generate

Additional Information

有关其他可能的应用场景,请参阅文档:
Dell EMC PowerStore REST API 参考指南:
https://dl.dell.com/content/manual25792673-dell-emc-powerstore-rest-api-reference-guide.pdf

Dell EMC PowerStore REST API 开发人员指南
https://dl.dell.com/content/manual55475248-dell-emc-powerstore-rest-api-developers-guide.pdf

以及使用 swaggerui 的内置文档 https://<PowerStore IP>/swaggerui/

Article Properties


Affected Product

PowerStore 1000X, PowerStore 1000T, PowerStore 1200T, PowerStore 3000X, PowerStore 3000T, PowerStore 3200T, PowerStore 5000X, PowerStore 5000T, PowerStore 500T, PowerStore 5200T, PowerStore 7000X, PowerStore 7000T, PowerStore 9000T, PowerStore 9200T

Last Published Date

15 Dec 2022

Version

5

Article Type

How To