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: Managen einer REST API-Sitzung

Summary: So erhalten Sie das Token, das an mehrere REST API-Abfragen übergeben werden soll.

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

Starten Sie eine neue Anmeldesitzung:
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


Hier wird die partielle Ausgabe gezeigt. Sie werden aufgefordert, Ihr Kennwort einzugeben:
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"}]


Alternativ kann das Kennwort interaktiv übergeben werden:
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

Wenn Sie das oben abgerufene Token verwenden und den Namen der Cookiedatei konsistent beibehalten, können REST-API-Abfragen jetzt als eine einzige Sitzung ohne weitere Authentifizierung ausgeführt werden.

 

Beispiele

Hinweis: „| jq“ kann aus diesen Beispielen entfernt werden, wenn „curl“ für Windows verwendet wird oder wenn „jq“ nicht installiert ist.
 

Appliance-Details auflisten

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"
  }
]
 

Lokale NutzerInnen auflisten

Beachten Sie die Verwendung von ?select=id,name,role_id, um drei bestimmte Spalten auszuwählen:
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
 

IPs auflisten

Beachten Sie die Verwendung des Platzhalters, um alle Spalten auszuwählen:
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
 

Kennzahlen erzeugen

Dieses Beispiel ist ein POST-Befehl und erfordert einen Text, der angibt, welche Metriken erfasst werden sollen. Dies hat die Form -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

Weitere mögliche Anwendungsbeispiele finden Sie in der Dokumentation:
Dell EMC PowerStore REST API – Referenzhandbuch:
https://dl.dell.com/content/manual25792673-dell-emc-powerstore-rest-api-reference-guide.pdf

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

Und die integrierte Dokumentation mit 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