NetWorker:如何使用 REST API 启动按需备份

Summary: 本知识库文章概述了如何使用 REST API 执行按需 NetWorker 备份。

This article applies to This article does not apply to This article is not tied to any specific product. Not all product versions are identified in this article.

Instructions

本知识库文章介绍使用 POST MAN 的 REST API 功能。POST MAN 是第三方 API 工具,可用于执行 REST API 功能。NetWorker 中不包括此内容。可以使用类似的 API 工具。各工具的 NetWorker 要求和 REST API 功能保持不变,但外观和位置可能会因所使用的工具而异。

本知识库文章面向对 REST API 函数(GET、POST 等)和所需标头有大致了解的读者。如果需要更多信息,请参阅以下 REST API 指南:https://developer.dell.com/apis/2378/versions/v3/docs/GettingStarted.md

 
 
1.首先执行 GET 请求以获取受保护客户端的列表:
GET https://NETWORKER_SERVERNAME:9090/nwrestapi/v3/global/clients

(可选)您可以筛选所需的数据,例如 resourceId、hostName、protectionGroups 和 saveSets:

GET https://NETWORKER_SERVERNAME:9090/nwrestapi/v3/global/clients?fl=resourceID,Hostname,protectionGroups,saveSets

例如:
image.png
图 1:显示用于收集客户端 resourceId、hostname、protectionGroups 和 saveSet 的 REST API GET 请求的 Post-Man 示例。

2.获取分配了 protectionGroup 的策略和工作流名称:

GET https://NETWORKER_SERVERNAME:9090/nwrestapi/v3/global/protectionpolicies?fl=name,workflows

选项 1:使用客户端 resourceId 启动单个客户端备份(所有存储集)。

使用步骤 1 中的 resourceId,为要备份的客户端生成 POST URI。

POST https://NETWORKER_SERVERNAME:9090/nwrestapi/v3/global/clients/resourceId/op/backup

由于这是 POST,因此必须在请求中指定 JSON 正文。在本例中,我们指定可从步骤 2 中的输出中收集的策略和工作流。

{
    "policy": "POLICY_NAME",
    "workflow": "WORKFLOW_NAME"
}

例如:
image.png
图 2:POST MAN 示例显示了用于启动客户端备份的 REST API POST 操作。

如果成功,则返回状态码 201。

选项 2:使用保护策略启动一个或多个客户端备份:

使用保护策略和工作流名称为包含要备份的一个或多个客户端的策略和工作流生成 POST URI:

POST https://NETWORKER_SERVERNAME:9090/nwrestapi/v3/global/protectionpolicies/POLICY_NAME/workflows/WORKFLOW_NAME/op/backup

由于这是 POST,因此必须在请求中指定 JSON 正文。在本例中,我们指定可从步骤 1 中的输出中收集的客户端名称。

{
   "clients": ["CLIENT_1","CLIENT_2"]
}

例如:

image.png
图 3:POST MAN 示例,展示了用于启动保护策略的 POST 操作,并仅选择保护组中配置的部分客户端。

如果成功,则返回状态码 201。

如果要为整个策略启动备份;在 JSON 正文中指定以下内容:

{}

通过执行此操作,将备份在分配给工作流的保护组中配置的所有客户端。

(可选)您还可以使用客户端指定存储集:

{
   "clients": ["CLIENT_1:/etc/hosts","CLIENT_2:/var/log/messages"]
}

Additional Information

Affected Products

NetWorker

Products

NetWorker Family, NetWorker Series
Article Properties
Article Number: 000224014
Article Type: How To
Last Modified: 18 Apr 2025
Version:  2
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.