Documentation de l'API
Des instructions détaillées sur l'API REST de Devolutions Server sont disponibles dans la section Applis et outils connexes de l'interface Web de Devolutions Server, sous Aide et outils – Documentation de l'API.
Pour vous connecter et utiliser l'API REST, consultez l'exemple de script bash ci-dessous. Pour chaque appel d'API au serveur, assurez-vous de ce qui suit :
Remplacez
https://urlpar l'URL spécifique de Devolutions Server.Remplacez
GUID-OF-VAULTetGUID-OF-ENTRYpar les GUID correspondants.
# 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"Mis à jour
Ce contenu vous a-t-il été utile ?