Anmeldedaten
Die API der Anmeldedaten ermöglicht das Abrufen von Informationen und das Entfernen von Anmeldedaten in NetCrunch
get-credential-types
Die Anmeldedatentypen abrufen
Rufen Sie eine Liste der Anmeldedatentypen als Array ab
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>')
Statuscodes
| Statuscode | Beschreibung |
|---|---|
| 200 | OK |
| 401 | Zugriff abgelehnt |
Ergebnis
["BSD","ESXi","Linux","Mac OS X","Solaris","Windows","Database Connection","HTTP","Email incoming","IPMI","Email (SMTP)","Simple"]
get-names-of-defined-credentials
Die Namen der definierten Anmeldedaten abrufen
Rufen Sie eine Liste der definierten Anmeldedaten ab
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>')
Parameters
| Name | Beschreibung |
|---|---|
| type | Anmeldedatentyp |
Statuscodes
| Statuscode | Beschreibung |
|---|---|
| 200 | OK |
| 401 | Zugriff abgelehnt |
Ergebnis
["<Default>","New Profile"]
remove-credentials
Die Anmeldedaten entfernen
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, headers=headers)
Parameter
| Name | Beschreibung |
|---|---|
| type | Anmeldedatentyp |
| name | Name der zu löschenden Anmeldedaten |
Statuscodes
| Statuscode | Beschreibung |
|---|---|
| 200 | OK |
| 401 | Zugriff abgelehnt |
Ergebnis
{"status":"success","message":"OK"}