PowerStore: Een REST API-sessie beheren
Riepilogo: Het token verkrijgen om door te geven aan meerdere REST API-query's.
Questo articolo si applica a
Questo articolo non si applica a
Questo articolo non è legato a un prodotto specifico.
Non tutte le versioni del prodotto sono identificate in questo articolo.
Istruzioni
Start een nieuwe aanmeldingssessie:
Gedeeltelijke uitvoer wordt hier weergegeven. U wordt gevraagd om uw wachtwoord:
U kunt het wachtwoord ook interactief doorgeven:
Met behulp van het token dat hierboven is verkregen en de naam van het cookiebestand consistent te houden, kunnen REST API-query's nu worden uitgevoerd als één sessie zonder verdere verificatie.
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
Gedeeltelijke uitvoer wordt hier weergegeven. U wordt gevraagd om uw wachtwoord:
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"}]
U kunt het wachtwoord ook interactief doorgeven:
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
Met behulp van het token dat hierboven is verkregen en de naam van het cookiebestand consistent te houden, kunnen REST API-query's nu worden uitgevoerd als één sessie zonder verdere verificatie.
Voorbeelden
Opmerking: "| jq" kan uit deze voorbeelden worden verwijderd als u curl voor Windows gebruikt of als jq niet is geïnstalleerd.Apparaatgegevens weergeven
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"
}
]
Lijst met lokale gebruikers
Let op het gebruik van ?select=id, naam, role_id om drie specifieke kolommen te selecteren: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's weergeven
Let op het gebruik van de jokerteken om alle kolommen te selecteren: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
Statistieken genereren
Dit voorbeeld is een POST-opdracht en vereist een body die aangeeft welke statistieken moeten worden verzameld. Dit neemt het formulier -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
Informazioni aggiuntive
Voor andere mogelijke gebruiksscenario's raadpleegt u de documentatie:
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
And the built-in documentation usingggerui https://< PowerStore IP >/ggerui/
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
And the built-in documentation usingggerui https://< PowerStore IP >/ggerui/
Prodotti interessati
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 9200TProprietà dell'articolo
Numero articolo: 000202473
Tipo di articolo: How To
Ultima modifica: 15 dic 2022
Versione: 5
Trova risposta alle tue domande dagli altri utenti Dell
Support Services
Verifica che il dispositivo sia coperto dai Servizi di supporto.