PowerStore:REST APIセッションの管理

Summary: 複数のREST APIクエリーに渡すトークンを取得する方法。

This article applies to This article does not apply to This article is not tied to any specific product. Not all product versions are identified in this article.

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クエリーを1つのセッションとして実行することができます。

 

注:Windowsでcurlを使用している場合、または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を使用して、これらの3つの特定の列を選択します。
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 Reference Guide
https://dl.dell.com/content/manual25792673-dell-emc-powerstore-rest-api-reference-guide.pdf

Dell EMC PowerStore REST API Developers Guide
https://dl.dell.com/content/manual55475248-dell-emc-powerstore-rest-api-developers-guide.pdf

swaggeruiを使用した組み込みドキュメントhttps://<PowerStore IP>/swaggerui/

Affected Products

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
Article Properties
Article Number: 000202473
Article Type: How To
Last Modified: 15 Dec 2022
Version:  5
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.