cancel
Showing results for 
Search instead for 
Did you mean: 

FIlter in REST API requests is ignored

andahay
Level 1

Hello!

About 2 months ago I used NetBackup 8.1.2 and write some software for its' monitoring. Lately my collegues updated NetBackup to 9.1 version. Now my software doesn't work. I used rather simple requests: getting backup jobs for last 12h; list of images for last 12h and so on. I found that the encoding of page[limit] and page[offset] params was changed a little. Now requests with them works fine (400 code was before fixes). But when I add filter parameter - nothing changes in server reply. I've tried different ways of encoding filter param, but there is still no effect. Here is the list of requests i've tried to get backup jobs at least: 

curl -H "Accept: application/vnd.netbackup+json;version=1.0" -H "Authorization: <token>" -k -X GET "https://<server>:<port>/netbackup/admin/jobs?page%5Blimit%5D=3&page%5Boffset%5D=0&filter%3DjobType%20eq%20%27BACKUP%27"

curl -H "Accept: application/vnd.netbackup+json;version=1.0" -H "Authorization: <token>" -k -X GET "https://<server>:<port>/netbackup/admin/jobs?page%5Blimit%5D=3&page%5Boffset%5D=0&filter=jobType%20eq%20'BACKUP'"

curl -H "Accept: application/vnd.netbackup+json;version=1.0" -H "Authorization: <token>" -k -X GET "https://<server>:<port>/netbackup/admin/jobs?page%5Blimit%5D=3&page%5Boffset%5D=0&filter=jobType%20eq%20%27BACKUP%27"

curl -H "Accept: application/vnd.netbackup+json;version=1.0" -H "Authorization: <token>" -k -X GET "https://<server>:<port>/netbackup/admin/jobs?page%5Blimit%5D=3&page%5Boffset%5D=0&filter=jobType+eq+'BACKUP'"

curl -H "Accept: application/vnd.netbackup+json;version=1.0" -H "Authorization: <token>" -k -X GET "https://<server>:<port>/netbackup/admin/jobs?page%5Blimit%5D=3&page%5Boffset%5D=0&filter=jobType+eq+%27BACKUP%27"

curl -H "Accept: application/vnd.netbackup+json;version=1.0" -H "Authorization: <token>" -k -X GET "https://<server>:<port>/netbackup/admin/jobs?page%5Blimit%5D=3&page%5Boffset%5D=0&filter=(jobType+eq+'BACKUP')"

Tell me, pleace, where is my mistake?

p.s. now I use curl to find the way of filter encoding, lately i'll just fix my software

1 REPLY 1

feb77979
Level 1

I faced the same issue. Upgrading Netbackup to 10 stopped the API queries working but I only had to change the square brackets.

url1=$(echo "https://$NBNAME:1556/netbackup/admin/jobs?page%5Boffset%5D=0&page%5Blimit%5D=100&sort=clientName&filter=jobType eq 'BACKUP' and startTime gt $nbsearchdate)" | sed 's/ /%20/g'