[SOLVED] PBS API

zebisnaga

New Member
Feb 3, 2023
18
0
1
Hi guys,

I'm working on monitoring the completion of backup tasks in Proxmox Backup Server (PBS). My goal is to track when a backup task finishes and receive notifications when all backup tasks report a status of "ok."

I’ve reviewed the API documentation at Proxmox API Viewer, but it appears that the endpoint for checking the status of backup tasks isn't functioning as expected.

Has anyone encountered similar issues or can offer guidance on how to properly monitor backup task statuses using the PBS API?

Using curl I have the following:

$ curl -H 'Authorization: PBSAPIToken=root@pam!api:<REDACTED>' 'https://PBS:8007/api2/json/nodes/localhost/tasks/UPID:nas1:000004D5:00000505:0000001D:66DED70D:backup:backupProxmox\\x3act-100:root@pam/log' -k
parameter verification failed - 'upid': value does not match the regex pattern

So after this i noticed the \\x3act and that is :
I then proceed to change the enconding to the : but once again I have the same error

$ curl -H 'Authorization: PBSAPIToken=root@pam!api:<REDACTED>' 'https://PBS:8007/api2/json/nodes/localhost/tasks/UPID:nas1:000004D5:00000505:0000001D:66DED70D:backup:backupProxmox:ct-100:root@pam/log' -kparameter verification failed - 'upid': value does not match the regex pattern%

This works just fine for other tasks, such as aptupdate
$ curl -H 'Authorization: PBSAPIToken=root@pam!api:<REDACTED>' 'https://PBS:8007/api2/json/nodes/localhost/tasks/UPID:nas1:00019276:000B6B2D:00000000:66DEDAF9:aptupdate::root@pam:/log' -k
{"data":[{"n":1,"t":"2024-09-09T12:24:41+01:00: starting apt-get update"},{"n":2,"t":"2024-09-09T12:24:42+01:00: Hit:1 http://deb.debian.org/debian bookworm InRelease"},{"n":3,"t":"Get:2 http://security.debian.org/debian-security bookworm-security InRelease [48.0 kB]"},{"n":4,"t":"Hit:3 http://deb.debian.org/debian bookworm-updates InRelease"},{"n":5,"t":"Get:4 http://download.proxmox.com/debian/pbs bookworm InRelease [2,782 B]"},{"n":6,"t":"Fetched 50.7 kB in 0s (125 kB/s)"},{"n":7,"t":"Reading package lists..."},{"n":8,"t":""},{"n":9,"t":"2024-09-09T12:24:42+01:00: TASK OK"}],"success":1,"total":9}%
 
Hi guys,

I'm working on monitoring the completion of backup tasks in Proxmox Backup Server (PBS). My goal is to track when a backup task finishes and receive notifications when all backup tasks report a status of "ok."

I’ve reviewed the API documentation at Proxmox API Viewer, but it appears that the endpoint for checking the status of backup tasks isn't functioning as expected.

Has anyone encountered similar issues or can offer guidance on how to properly monitor backup task statuses using the PBS API?

Using curl I have the following:

$ curl -H 'Authorization: PBSAPIToken=root@pam!api:<REDACTED>' 'https://PBS:8007/api2/json/nodes/localhost/tasks/UPID:nas1:000004D5:00000505:0000001D:66DED70D:backup:backupProxmox\\x3act-100:root@pam/log' -k
parameter verification failed - 'upid': value does not match the regex pattern

So after this i noticed the \\x3act and that is :
I then proceed to change the enconding to the : but once again I have the same error

$ curl -H 'Authorization: PBSAPIToken=root@pam!api:<REDACTED>' 'https://PBS:8007/api2/json/nodes/localhost/tasks/UPID:nas1:000004D5:00000505:0000001D:66DED70D:backup:backupProxmox:ct-100:root@pam/log' -kparameter verification failed - 'upid': value does not match the regex pattern%

This works just fine for other tasks, such as aptupdate
$ curl -H 'Authorization: PBSAPIToken=root@pam!api:<REDACTED>' 'https://PBS:8007/api2/json/nodes/localhost/tasks/UPID:nas1:00019276:000B6B2D:00000000:66DEDAF9:aptupdate::root@pam:/log' -k
{"data":[{"n":1,"t":"2024-09-09T12:24:41+01:00: starting apt-get update"},{"n":2,"t":"2024-09-09T12:24:42+01:00: Hit:1 http://deb.debian.org/debian bookworm InRelease"},{"n":3,"t":"Get:2 http://security.debian.org/debian-security bookworm-security InRelease [48.0 kB]"},{"n":4,"t":"Hit:3 http://deb.debian.org/debian bookworm-updates InRelease"},{"n":5,"t":"Get:4 http://download.proxmox.com/debian/pbs bookworm InRelease [2,782 B]"},{"n":6,"t":"Fetched 50.7 kB in 0s (125 kB/s)"},{"n":7,"t":"Reading package lists..."},{"n":8,"t":""},{"n":9,"t":"2024-09-09T12:24:42+01:00: TASK OK"}],"success":1,"total":9}%
Hi,
please try to urlencode the UPID and see if that works for you.
 
Hi,
please try to urlencode the UPID and see if that works for you.
Hi,
That still does not work.
I decided to get the tasks since a certain epoch time and that was my workaround.
// https://PBS:8007/api2/json/nodes/localhost/tasks?since=1726657200

Then the backups are listed here and it contains the status.
However i still think PBS API is broken
 
Hi,
That still does not work.
I decided to get the tasks since a certain epoch time and that was my workaround.
// https://PBS:8007/api2/json/nodes/localhost/tasks?since=1726657200

Then the backups are listed here and it contains the status.
However i still think PBS API is broken
Used your curl command to get the task log for a backup and got no error (with the UPID containing the \\x3a which escapes a : and ending in : as required). What is your proxmox-backup-manager version --verbose?
 
Used your curl command to get the task log for a backup and got no error (with the UPID containing the \\x3a which escapes a : and ending in : as required). What is your proxmox-backup-manager version --verbose?
can you provide your full curl command redacting the pbs api secret?
i am running Backup Server 3.2-7
 
can you provide your full curl command redacting the pbs api secret?
i am running Backup Server 3.2-7
It is basically the same as your previously posted command, but do note that you are missing a colon at the end of the UPID, as I tried to highlight in orange:
curl -H 'Authorization: PBSAPIToken=root@pam!api:<REDACTED>' 'https://pbs:8007/api2/json/nodes/localhost/tasks/UPID:nas1:000004D5:00000505:0000001D:66DED70D:backup:backupProxmox\\x3act-100:root@pam:/log' -k
 
Last edited:
It is basically the same as your previously posted command, but do note that you are missing a colon at the end of the UPID, as I tried to highlight in orange:
curl -H 'Authorization: PBSAPIToken=root@pam!api:<REDACTED>' 'https://pbs:8007/api2/json/nodes/localhost/tasks/UPID:nas1:000004D5:00000505:0000001D:66DED70D:backup:backupProxmox\\x3act-100:root@pam:/log' -k
That is super strange. I even tried using bash instead of zsh and I still get the following

1726753398937.png
 
Last edited:
  • Like
Reactions: zebisnaga

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!