NetWorker

Last reply by 06-21-2022 Unsolved
Start a Discussion
2 Bronze
2 Bronze
3894

NetWorker 9.1 REST API : Is there a way to filter (by date) the GET /backups output?

Hello,

Using the NetWorker rest API, I am able to retrieve the backups using the GET /backups method. However, it seems that the output will contain all the backups in the database.

I would like to be able to "filter by date", i.e. only get the backup since last time I made the call. So I would like to be able to filter, say, on the backup creation date being more recent than a certain date.

The REST API reference doesn't hint at any filtering capabilities. However, the REST API Getting Started guide clearly indicates that filtering exists. It gives a few examples to filter on fields ("Viewing only selected fields for all clients") or to filter on field values ("Searching for clients"). But the filter query feature doesn't seem to be specified.

Does anybody know how to filter on the backup creation date being before or after an arbitrary date?

Thanks,

Laurent.

Replies (5)
7 Plutonium
2477

As I said in previous thread, didn't try it, but by looking quickly at docs, would something like GET /nwrestapi/v2/global/Backup?fl=clientHostname,name,level&q=creationTime:>=MM/DD/YYYY make sense?

2477

It makes sense of course and I tried it but it looks like queries only expect a ":"

Also, I could try many formats for specifying the date and miss the only one that would (possibly) be allowed so I am hoping someone at EMC would know how to do it and give an example.

2465

Hi Laurent_1,

I was working with the NetWorker 9.2 REST-API today and figured out the following solution to the date filtering on the backups endpoint:

https://networker-server-hostname:9090/nwrestapi/v3/global/backups?q=saveTime:['2019-01-01T10:00:00' TO '2019-01-01T10:15:00']

Make sure not to forget the qoutes around the dates.

Best wishes
Stefan Schröder/Schmitz RZ Consult GmbH
BACKUP EAGLE Reporting for NetWorker/www.backup-eagle.com

320

I am getting failure as shown below

C:\WINDOWS\system32>curl -i -X GET -k -u corpads.local\amaurya:Inventive9get$worm -H "Content-Type:application/json" https://nwsppl300p:9090/nwrestapi/v3/global/Backup?fl=clientHostname,name,level&q=creationTime:['202...' TO '2022-06-17T10:15:00']
HTTP/1.1 404
Content-Security-Policy: frame-ancestors 'none';script-src' 'self';object-src 'self'
Strict-Transport-Security: max-age=31536000
X-XSS-Protection: 1; mode=block
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
Allow: GET,OPTIONS,HEAD
Date: Fri, 17 Jun 2022 14:11:33 GMT
Cache-Control: no-cache,no-store,must-revalidate
Pragma: no-cache
Expires: 0
Content-Length: 0
Server: NSR SERVICES for Authentication

'q' is not recognized as an internal or external command,
operable program or batch file.

264

I hope you are aware you are sharing your password with the internet in the curl command or did you at least fill in a fake user and password (not by the looks of it)?

I have been testing similar queries on a nw19.5.0.6 NW NVE server today, and I couldn't (yet) get rest api calls to work if they use the :['FROM_DATE' TO 'TO_DATE'] structures. More simple queries all work.

It seems to not be able to parse the Time Range Based Filtering information correctly. Similar with other example on the rest api site https://developer.dell.com when using an "AND" structure using more than one thing to look for.

Like the examples from https://developer.dell.com/apis/2378/versions/v3/docs/tutorials/Tutorial-4QuerySupport.md (but then of course use the appropriate settings for my environment, I for one use an SSL encoded username:password and not completely plain text. Still is just only encoded, not encrypted, so sharing it with the internet, wouldn't be safe either):

curl -X GET -H "Content-Type: application/json" -u Administrator:Password123# -H "X-PrettyPrint:1" https://mars:9090/nwrestapi/v3/global/backups?q=saveTime:['2019-04-30T21:00:05' TO '2019-04-30T22:00:05']

or

curl -X GET -H "Content-Type: application/json" -u Administrator:Password123# -H "X-PrettyPrint:1"  "https://mars:9090/nwrestapi/v2/global/backups?q=clientHostname:ISILON and level:Incr&fl=name,shortId,level"

 
Not even with the example from KB article 000021654 "NetWorker REST API: How to list failed jobs with Time Range Based Filtering" which uses double-quotes instead of single quotes, but I get an host "TO" error, so it seems to parse the command as if it is supposed to be the host to connect to? When I remove the AND construct, then it shows output. So there must be something with incorrectly parsing the command. Tried escaping the single quotes and double quotes, but haven't yet found a solution to it. I'll might test also next week on a RHEL server instead of using curl on a NW NVE (which runs Suse).

https://networkerserver01:9090/nwrestapi/v3/global/jobs?q=completionStatus:"failed" and startTime:
["2020-04-28T01:17:04" TO "2020-04-30T14:17:04"]

You also see that this community website isn't able to treat this as one URL, hehe...

Latest Solutions
Top Contributor