Cài đặt giấy phép
Phiên bản sản phẩm: 10.11
Cập nhật lần cuối: 31 tháng 7 năm 2024
Cài đặt giấy phép sản phẩm. Vui lòng tham khảo phần “Giấy phép” để biết thêm chi tiết.
Điểm cuối
https://<Director_IP_address>:4443/c/router
Ví dụ về yêu cầu
Phương thức này chấp nhận một multipart/form-data tệp tải lên thay vì nội dung JSON. Gửi từng trường yêu cầu (action, method, data, type, và tid) dưới dạng một trường biểu mẫu riêng biệt. Gửi tệp giấy phép dưới dạng licenseFile trường biểu mẫu: nó không phải là một phần của 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]
Các trường yêu cầu
|
Lĩnh vực
|
Loại
|
Giá trị(các giá trị)
|
Mô tả |
|---|---|---|---|
licenseFile |
chuỗi |
|
Vị trí của tệp giấy phép cần tải lên |
action |
chuỗi |
|
Hành động được gọi |
method
|
chuỗi |
|
Phương thức được gọi |
data
|
mảng |
|
Mảng có một phần tử (kiểu boolean): true cài đặt giấy phép ở chế độ nền, false chờ cho đến khi giấy phép được cài đặt xong. Sử dụng false trong một tập lệnh phải đợi cho đến khi quá trình cài đặt hoàn tất |
type
|
chuỗi |
|
Loại giao thức truyền thông |
tid
|
số nguyên |
|
Mã giao dịch. Được sử dụng để xác định yêu cầu bởi cả máy khách và máy chủ |
Lưu ý
Bạn có thể cài đặt giấy phép của mình bằng một tập lệnh PowerShell. Hãy xem ví dụ dưới đây.
# 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;
Mẫu câu trả lời
{
"action": "LicensingManagement",
"method": "installLicense",
"tid": "1",
"type": "rpc",
"message": null,
"where": null,
"cause": null,
"data": null
}
Các trường phản hồi
|
Lĩnh vực
|
Giá trị
|
Mô tả
|
|---|---|---|
message
|
chuỗi | Hiển thị thông báo nếu yêu cầu không thành công |
where
|
chuỗi | Thông tin về phương pháp mà tại đó sự cố đã xảy ra |
cause
|
chuỗi | Nguyên nhân gây hỏng hóc |
| dữ liệu | chuỗi |
|