Zainstaluj licencję
Wersja produktu: 10.11
Ostatnia aktualizacja: 31 lipca 2024 r.
Instaluje licencję produktu. Szczegółowe informacje można znaleźć w sekcji „Licencjonowanie ”.
Punkt końcowy
https://<Director_IP_address>:4443/c/router
Przykład zapytania
Ta metoda przyjmuje multipart/form-data plik przesłany zamiast treści JSON. Prześlij każde pole żądania (action, method, data, type, oraz tid) jako osobne pole formularza. Wyślij plik licencji jako licenseFile pole formularza: nie jest on częścią 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]
Pola żądania
|
Pole
|
Typ
|
Wartość(-y)
|
Description |
|---|---|---|---|
licenseFile |
ciąg znaków |
|
Lokalizacja pliku licencji, który należy przesłać |
action |
ciąg znaków |
|
Wywołana akcja |
method
|
ciąg znaków |
|
Wywoływana metoda |
data
|
tablica |
|
Tablica zawierająca jeden element (wartość logiczna): true instaluje licencję w tle, false czeka, aż licencja zostanie zainstalowana. Użyj false w skrypcie, który musi poczekać na zakończenie instalacji |
type
|
ciąg znaków |
|
Rodzaj protokołu komunikacyjnego |
tid
|
liczba całkowita |
|
Identyfikator transakcji. Służy do identyfikacji żądania zarówno przez klienta, jak i serwer |
Uwaga
Licencję można zainstalować za pomocą skryptu PowerShell. Poniżej znajduje się przykład.
# 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;
Przykładowa odpowiedź
{
"action": "LicensingManagement",
"method": "installLicense",
"tid": "1",
"type": "rpc",
"message": null,
"where": null,
"cause": null,
"data": null
}
Pola odpowiedzi
|
Pole
|
Wartość
|
Description
|
|---|---|---|
message
|
ciąg znaków | Komunikat w przypadku niepowodzenia żądania |
where
|
ciąg znaków | Odniesienie do metody, w której wystąpił problem |
cause
|
ciąg znaków | Przyczyna awarii |
| dane | ciąg znaków |
|