Installa la licenza
Versione del prodotto: 10.11
Ultima modifica: 31 luglio 2024
Installa una licenza del prodotto. Per ulteriori dettagli, consultare la sezione "Licenze".
Endpoint
https://<Director_IP_address>:4443/c/router
Esempio di richiesta
Questo metodo accetta un multipart/form-data upload anziché un corpo JSON. Invia ogni campo della richiesta (action, method, data, type, e tid) come campo separato del modulo. Invia il file di licenza come licenseFile campo del modulo: non fa parte di data.
curl --request POST \
--url https://<Director_IP_address>:4443/c/router \
--cookie cookies.txt \
--header "content-type: multipart/form-data" \
--form licenseFile=@ent.lic \
--form action=LicensingManagement \
--form method=installLicense \
--form tid=1 \
--form type=rpc \
--form data=[true]
Campi della richiesta
|
Campo
|
Tipo
|
Valore/i
|
Description |
|---|---|---|---|
licenseFile |
stringa |
|
Ubicazione del file di licenza da caricare |
action |
stringa |
|
L'azione che viene richiamata |
method
|
stringa |
|
Il metodo che viene richiamato |
data
|
array |
|
Array con un elemento (booleano): true installa la licenza in background, false attende che la licenza sia installata. Utilizza false in uno script che deve attendere che l'installazione termini |
type
|
stringa |
|
Tipo di protocollo di comunicazione |
tid
|
numero intero |
|
ID transazione. Utilizzato per identificare la richiesta sia da parte del client che del server |
Nota
È possibile installare la licenza tramite uno script PowerShell. Di seguito trovi un esempio.
# Get the cookies from the login call
$Cookie = New-Object System.Net.Cookie;
$Cookie.Name = "JSESSIONID-1518008951"; # Example, replace the string
$Cookie.Value = "1B02CE0DD33B4BFB926EFD44516523AB"; # Example, replace the string
$Cookie.Domain = "localhost";
$WebSession = New-Object Microsoft.PowerShell.Commands.WebRequestSession;
$WebSession.Cookies.Add($Cookie);
$LF = "`r`n";
$boundary = [System.Guid]::NewGuid().ToString()
$fileBytes = [System.IO.File]::ReadAllBytes('e:\trial.bin'); # License file, replace the path
$fileEnc = [System.Text.Encoding]::GetEncoding('iso-8859-1').GetString($fileBytes);
$tid = 1; # Use an auto-increment instead of fixed number
# Build body for the form-data manually since PS does not support multipart/form-data out of the box
$bodyLines = (
"--$boundary",
"Content-Disposition: form-data; name=`"action`"",
'',
'LicensingManagement',
"--$boundary",
"Content-Disposition: form-data; name=`"method`"",
'',
'installLicense',
"--$boundary",
"Content-Disposition: form-data; name=`"type`"",
'',
'rpc',
"--$boundary",
"Content-Disposition: form-data; name=`"tid`"",
'',
$tid,
"--$boundary",
"Content-Disposition: form-data; name=`"data`"",
'',
'[true]', # true=async, false=sync (wait for install)
"--$boundary",
"Content-Disposition: form-data; name=`"licenseFile`"; filename=`"trial.bin`"",
"Content-Type: application/octet-stream",
'',
$fileEnc,
"--$boundary--"
) -join $LF
# Allow self-signed certificate
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
# Use TLS1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$uri = 'https://localhost:4443/c/router';
Invoke-RestMethod -Verbose -Uri $uri -Method Post -ContentType "multipart/form-data; boundary=$boundary" -Body $bodyLines -WebSession $webSession;
Esempio di risposta
{
"action": "LicensingManagement",
"method": "installLicense",
"tid": "1",
"type": "rpc",
"message": null,
"where": null,
"cause": null,
"data": null
}
Campi di risposta
|
Campo
|
Valore
|
Description
|
|---|---|---|
message
|
stringa | Messaggio in caso di errore nella richiesta |
where
|
stringa | Riferimento al metodo in cui si è verificato il problema |
cause
|
stringa | Causa del guasto |
| dati | stringa |
|