PowerStore: gestione di una sessione API REST

Samenvatting: Come ottenere il token da passare a più query API REST.

Dit artikel is van toepassing op Dit artikel is niet van toepassing op Dit artikel is niet gebonden aan een specifiek product. Niet alle productversies worden in dit artikel vermeld.

Instructies

Avviare una nuova sessione di accesso:
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


Output parziale mostrato qui. Viene richiesta la password:
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"}]


In alternativa, la password può essere passata in modo interattivo:
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

Utilizzando il token ottenuto in precedenza e mantenendo coerente il nome del file dei cookie, le query dell'API REST possono ora essere eseguite come una singola sessione senza ulteriore autenticazione.

 

Esempi

Nota: è possibile rimuovere "| jq" da questi esempi se si utilizza curl per Windows o se jq non è installato.
 

Elenco dei dettagli dell'appliance

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

Elenco degli utenti locali

Notare l'utilizzo di ?select=id,name,role_id per selezionare tre colonne specifiche:
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
 

Elenco degli indirizzi IP

Notare l'utilizzo del carattere jolly per selezionare tutte le colonne:
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
 

Generazione delle metriche

Questo esempio è un comando POST e richiede un corpo che specifichi le metriche da raccogliere. Il formato è -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

Extra informatie

Per altri possibili casi d'uso, consultare la documentazione:
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

E la documentazione integrata utilizzando swaggerui https://<PowerStore IP>/swaggerui/

Getroffen producten

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
Artikeleigenschappen
Artikelnummer: 000202473
Artikeltype: How To
Laatst aangepast: 15 dec. 2022
Versie:  5
Vind antwoorden op uw vragen via andere Dell gebruikers
Support Services
Controleer of uw apparaat wordt gedekt door Support Services.