API-dokumentation
Detaljerede instruktioner til REST API'en for Devolutions Server findes i afsnittet Apps og ledsager værktøjer i webgrænsefladen i Devolutions Server under Hjælp og værktøjer – API-dokumentation.
For at oprette forbindelse og bruge REST API'en henvises der til bash-eksempelscriptet nedenfor. For hvert API-kald til serveren skal følgende sikres:
Erstat
https://urlmed den specifikke URL-adresse til Devolutions Server.Erstat
GUID-OF-VAULTogGUID-OF-ENTRYmed de tilsvarende GUID'er.
# Log in and get the token
authResponse=$(curl -s -X POST "https://url/api/v1/login" \
-H "Content-Type: application/json" \
-d '{
"appKey": "appkey",
"appSecret": "appsecret"
}')
token=$(echo $authResponse | jq -r '.tokenId')
# Check if the token was successfully obtained
if [ -z "$token" ] || [ "$token" = "null" ]; then
echo "Failed to login or obtain token."
exit 1
fi
# Request data using the token
response=$(curl -s -X GET "https://url/api/v1/vault/GUID-OF-VAULT/entry/GUID-OF-ENTRY" \
-H "Content-Type: application/json" \
-H "tokenId: $token")
echo $response | jq
# Log out
curl -s -X POST "https://url/api/v1/logout" \
-H "Content-Type: application/json" \
-H "tokenId: $token" \
-H "Content-Length: 0"Sidst opdateret
Var dette nyttigt?