PDF

Dane uwierzytelniające

API dla danych uwierzytelniających pozwala uzyskać informacje i usunąć dane uwierzytelniające w NetCrunchu

get-credential-types

Uzyskaj typy danych uwierzytelniających

Uzyskaj listę typu danych uwierzytelniających jako tablicę

GET/api/rest/2/credentials

cURL

curl --url "http://localhost/api/rest/2/credentials?api_key=<your-api-key>""

Node.js

const http = require('http'); http.get('http://localhost/api/rest/2/credentials?api_key=<your-api-key>', (res) => { res.setEncoding('utf8'); res.on('error', (error) => { console.log(error) }); res.on('data', (chunk) => { console.log(chunk) }) });

PowerShell

Invoke-RestMethod -Uri "http://localhost/api/rest/2/credentials?api_key=<your-api-key>"

Python

import requests requests.get('http://localhost/api/rest/2/credentials?api_key=<your-api-key>')

Kody statusu

Kod statusu Opis
200 OK
401 Brak dostępu

Wynik

["BSD","ESXi","Linux","Mac OS X","Solaris","Windows","Database Connection","HTTP","Email incoming","IPMI","Email (SMTP)","Simple"]

get-names-of-defined-credentials

Uzyskaj nazwy zdefiniowanych danych uwierzytelniających

Uzyskaj listę zdefiniowanych danych uwierzytelniających

GET/api/rest/2/credentials/<type>

cURL

curl --url "http://localhost/api/rest/2/credentials/Windows?api_key=<your-api-key>"

Node.js

const http = require('http'); http.get('http://localhost/api/rest/2/credentials/Windows?api_key=<your-api-key>', (res) => { res.setEncoding('utf8'); res.on('error', (error) => { console.log(error) }); res.on('data', (chunk) => { console.log(chunk) }) });

PowerShell

Invoke-RestMethod -Uri "http://localhost/api/rest/2/credentials/Windows?api_key=<your-api-key>"

Python

import requests requests.get('http://localhost/api/rest/2/credentials/Windows?api_key=<your-api-key>')

Parametry

Nazwa Opis
type Typ danych uwierzytelniających

Kody statusu

Kod statusu Opis
200 OK
401 Brak dostępu

Wynik

["<Default>","New Profile"]

remove-credentials

Usuń dane uwierzytelniające

DELETE/api/rest/2/credentials/<type>/<name>

cURL

curl --request DELETE --url "http://localhost/api/rest/2/credentials/Windows/MyCredentials?api_key=<your-api-key>"

Node.js

const http = require('http'), options = { method: 'DELETE', hostname: 'localhost', path: '/api/rest/2/credentials/Windows/MyCredentials' , headers: { "x-api-key": '<your-api-key>' } }; const req = http.request(options, (res) => { res.setEncoding('utf8');
res.on('error', (error) => { console.log(error) }); res.on('data', (chunk) => { console.log(chunk) }) }); req.end();

PowerShell

$url = "http://localhost/api/rest/2/credentials/Windows/MyCredentials" $hdrs = @{} $hdrs.Add("X-API-KEY","<your-api-key>") $hdrs.Add("Content-Type","application/json") Invoke-RestMethod -Uri $url -Method Delete -Headers $hdrs

Python

import requests url = 'http://localhost/api/rest/2/credentials/Windows/MyCredentials' headers = { 'Content-Type': 'application/json', 'x-api-key': '<your-api-key>' } response = requests.delete(url=url, headers=headers)

Parametry

Nazwa Opis
type Typ danych uwierzytelniających
name Nazwa danych uwierzytelniających do usunięcia

Kody statusu

Kod statusu Opis
200 OK
401 Brak dostępu

Wynik

{"status":"success","message":"OK"}