NetWorker REST API Triage Guide

Summary: This KB provides an overview of basic troubleshooting for RESTAPI-related issues.

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

NetWorker REST API Triage Guide

Watch on YouTube

Additional Information

Getting Started


Representational State Transfer (REST) Application Programming Interface (API) provides programmatic access to the NetWorker data protection service. By using REST API, NetWorker users can build client applications to automate NetWorker operations. NetWorker REST API is installed as part of NetWorker server installation in the same Apache tomcat container as the NetWorker authentication services. Authentication is done using the same credentials as is used for the NetWorker Management Console.  

REST API allows interaction with resources identified by Uniform Resource Identifier (URI) addresses. It uses HTTP verbs (HEAD, GET, PUT, POST, DELETE) to interact with the Uniform Resource Identifier (URI) in a stateless way (the server contains no client state, each message being self-descriptive).

This document deals with the interaction with NetWorker resources using user-written REST API calls. Not to be confused with the REST API calls which are used by back-end NetWorker operations.
 

Connecting to NetWorker:

There are several different REST API client technologies which can be used to run the commands to connect to NetWorker; including, curl commands (Linux), PowerShell Invoke-WebRequest (Windows), and REST API client browser extensions. 

There are three headers needed for connection:   
  • Content-Type: application/json
  • Accept: application/json
  • Authorization: Basic with Base 64 encoded username and password

In environments where the are multiple NetWorker datazones authenticating through a single NetWorker AUTHC server, an additional header is required:

  • X-NW-AUTHC-BASE-URL:AUTHC_HOSTNAME_OR_IP:AUTHC_PORT
The default AUTHC port is port 9090. The usage of this header is detailed in: RESTAPI: How to use a remote AUTHC server when processing RESTAPI requests?

The NetWorker REST API is exposed in the following base URI:

https://[nw-server-hostname]:9090/nwrestapi/
There are different versions of APIs. Enhancements have been rolled out since the REST API was initially implemented. For example:
https://[nw-server-hostname]:9090/nwrestapi/v1
https://[nw-server-hostname]:9090/nwrestapi/v2
https://[nw-server-hostname]:9090/nwrestapi/v3

The full json schema is available at

https://[nw-server-hostname]:9090/nwrestapi/v3/schemas/swagger.json

REST API Response Codes:
 
Success Response Codes
Success Code Applies to HTTP Method Response Body Content Description
200 GET Resource Representation. OK. The operations that result in this HTTP state carry the resource representation in the payload.
201 POST Empty Response. Created. This status indicates that a new resource or an intended job has been created and its associated URL is accessible from the location header in the response.
202 POST Details in Response. Accepted. This indicates that the API request has been accepted. The payload indicates that the URL to the tracking resource instance is accessible from the location header in the response.
204 PUT/DELETE Empty Response. No Content. The state indicates that the operation performed was successful. However, there are no additional details to be provided.
 
Error Response Codes
Error Code Description
400 Bad Request.
401 Invalid Credentials.
403 Insufficient Privileges.
404 Resource Not Found.
405 Method Not Allowed.
406 Invalid Locale is Specified.
500 Internal Server Error.


REST API Functions

Supported HTTP Methods
HTTP Method Action Description
GET Read Gets the resource representation.
POST Create Creates a new resource.
PUT Update Updates an existing resource.
DELETE Remove Deletes an existing resource.


Some Examples:

GET

 

List all clients.                                            

https://[nw-server-hostname]:9090/nwrestapi/v3/global/clients

One client only, showing only three fields (hostname, saveSets, and protectionGroups)      

https://[nw-server-hostname]:9090/nwrestapi/v3/global/clients?fl=hostname,saveSets,protectionGroups&q=hostname:nwserver121

List the Protection Groups which one client is in.     

https://[nw-server-hostname]:9090/nwrestapi/v3/global/clients?fl=protectionGroups&q=hostname:nwserver121

Show current alerts.                                     

https://[nw-server-hostname]:9090/nwrestapi/v3/global/alerts

Show recent failed jobs.                               

https://[nw-server-hostname]:9090/nwrestapi/v3/global/jobs?q=completionStatus:"Failed"&fl=clientHostname,startTime,name,message

List the workflows in one policy (named WinFS in this example).                   

https://[nw-server-hostname]:9090/nwrestapi/v3/global/protectionpolicies/WinFS/workflows

List the properties of one saveset instance only (as defined by client hostname and save set).      

https://[nw-server-hostname]:9090/nwrestapi/v3/global/clients?q=hostname:vm-lego-231 and saveSets:"/etc"

POST:

Start a workflow action.                                 

https://[nw-server-hostname]:9090/nwrestapi/v3/global/protectionpolicies/Angela/workflows/WinFS/op/backup
                                                      JSON Body: 
                                                      {
                                                       }

Create a new client instance (with default values for all properties except the four listed).           

https://[nw-server-hostname]:9090/nwrestapi/v3/global/clients  
                                                     JSON Body 
                                                     {    
            "hostname": "vm-lego-231",
            "backupType": "Filesystem",
            "saveSets": [ "/etc" ],
            "protectionGroups" : [ "LinuxFS" ]
                                                          


Required Information for Support


Environment:

  • NetWorker server name
  • NetWorker version and build number
  • NetWorker server host operating system type and version
Linux:
hostname
strings /usr/sbin/nsrd | grep -i "(#)"
cat /etc/*release
uname -a

Windows:

nsrwatch
Issue Details:
  • Explain which REST API operation is being performed (GET, POST, PUT, DELETE), the URI used, any JSON body contents (where applicable). 
  • REST API response code and any error message provided.
  • Has the initial connection and authorization succeeded between the REST API client and NetWorker?
Log Collection:
  • Rendered daemon.raw log file from the NetWorker server:
  • REST API logs from the NetWorker server:  /nsr/logs/restapi (linux) or EMC NetWorker\nsr\logs\restapi (Windows)
  • For authentication issues, see the standard NetWorker authentication logging in /nsr/authc/logs (linux) or ..\EMC NetWorker\nsr\authc-server\tomcat\logs (Windows)
Debug:
In more complex issues, REST API debugging may be required. Debug can be enabled as per: NetWorker: How to Enable REST API Debugging

Performance
If the issue is RESTAPI performance related you can use the following options to track resource consumption of the nsrtomc+ process used by API calls.

Linux:  
top -b | awk '/nsrtomc+/ {print strftime("%Y-%m-%d-%H:%M:%S", systime()), $0}'

This output shows standard top output but with human readable timestamps. This can be used to review CPU and memory consumption by the process and for how long it stayed in a certain state when a REST call was made. This can be compared against the restapi.log and AUTHC logs to see which calls were made and how frequently.
 

Windows: For windows servers you must install something like "Performance Monitor:

1. Open Performance Monitor as Administrator.
2. From the left pane, expand Monitoring Tools and select Performance Monitor.
3. Right-click inside the right pane and select Remove all Counters.
4. Right-click inside the right pane and select Add Counters.
5. Under Available Counters, expand Memory select % Commit Bytes and click Add.
6. Under Memory, select Available Bytes and click Add.
7. Under Available Counters expand Process and select % Processor Time and under Instances of Selected object select the first Java entry, click Add.
8. Under Available Counters expand Processor Information and select % Processor Utility, click Add.
9. The Added counters on the right pane should show:

image.png

10. Click Okay. Right-click Performance Monitor and click New->Data Collector Set.
11. Provide a name, e.g: RESTAPI_MON.
12. On the location screen click Next, unless you choose to specify an alternate output location.
13. Select Save and Close and click Finish.
14. In the left pane under Data Collector Sets->User Defined open the RESTAPI_MON properties and select Comma Separated for the log format, click Ok.

image.png

15. In the left pane under Data Collector Sets->User Defined select the RESTAPI_MON data collector set and click Start (Play button).
16. If the default output location was used, the .csv file appears under C:\PerfLogs\Admin\RESTAPI_MON.
17. Once the issue is observed and recorded in the output file, you can stop monitoring click by clicking Stop under Data Collector Sets-User Defined.


Further Resources

All supported REST API endpoints and usage examples are provided in: NetWorker REST API Reference Guide

Affected Products

NetWorker Series

Products

NetWorker Series
Article Properties
Article Number: 000014298
Article Type: How To
Last Modified: 07 Feb 2024
Version:  6
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.