Can't Create Schedule with REST API on Bareos

107 views
Skip to first unread message

Hoa Ngo

unread,
Nov 10, 2024, 9:41:56 PM11/10/24
to bareos-users
My REST-API server uses Bareos user with admin rights,
I read the BareOS Rest API modification guide and followed it but I can't create schedules through the API
Could you check it over and fix it for me?

1.png2.png
Best regards,

Minh Hoa

Jörg Steffens

unread,
Nov 11, 2024, 4:09:16 AM11/11/24
to bareos...@googlegroups.com
On 11.11.24 at 03:41 wrote Hoa Ngo:
> My REST-API server uses Bareos user with admin rights,

I doubt that this user has sufficient permissions.
What user do you use to authenticate and what is his configuration?
(in "bconsole" type the command "show console" or "show
console=<username>"). In doubt also the profile configuration ("show
profile").
Be aware, that the "operator" and "webui-admin" profile do not have
sufficient permissions for this.

Regards,
Jörg



> I read the BareOS Rest API modification guide and followed it but I
> can't create schedules through the API
> Could you check it over and fix it for me?
>
> 1.png2.png
> Best regards,
>
> Minh Hoa
>
> --
> You received this message because you are subscribed to the Google
> Groups "bareos-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to bareos-users...@googlegroups.com
> <mailto:bareos-users...@googlegroups.com>.
> To view this discussion visit
> https://groups.google.com/d/msgid/bareos-users/e272c5a2-ebd2-4be9-b025-81ed4b5c62b1n%40googlegroups.com <https://groups.google.com/d/msgid/bareos-users/e272c5a2-ebd2-4be9-b025-81ed4b5c62b1n%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
Jörg Steffens joerg.s...@bareos.com
Bareos GmbH & Co. KG Phone: +49 221 630693-91
https://www.bareos.com

Sitz der Gesellschaft: Köln | Amtsgericht Köln: HRA 29646
Komplementär: Bareos Verwaltungs-GmbH
Geschäftsführer: Stephan Dühr, Jörg Steffens, Philipp Storz


Message has been deleted
Message has been deleted

Hoa Ngo

unread,
Nov 11, 2024, 5:08:05 AM11/11/24
to bareos-users
Dear Jörg Steffens,

When I made another profile with complete access, I was able to resolve the aforementioned issue. Another issue, though, is that I receive the following error when I set the "runCommand" argument to "run" and begin running via the REST API. Additionally, I'm not sure how to set up the "Create Schedule" function when passing JSON from a REST API.
Would you please check my configure files?
--------------------------------
models.py:
class scheduleResource(BaseModel):
    name: str = Body(..., title="Schedule name")
    description: Optional[str] = Body(None, title="Schedule Description")
    run: Optional[List[str]] = Body(
        None,
        title="A list of run statements",
        example=["Full 1st Sat at 12:00", "Incremental Sun-Fri at 11:00"],
    )
    enabled: Optional[bareosBool] = Body(
        None, title="Schedule enabled? Yes, if unset", example="no"
    )
---------------------------------------------
openapi.json:
"run": {
            "title": "A list of run statements",
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "Full 1st Sat at 12:00",
              "Incremental Sun-Fri at 11:00"
            ]
          },
--------------------------------------------------------
Error:
{ "message": "Could not add schedule with command 'configure add schedule name=Test description=Test123 run=FullMondayat17:50 enabled=yes'. Message: 'failed: configure error: Time must be preceded by keyword AT.\nconfigure error: unexpected token 105 BCT_UNQUOTED_STRING in resource definition\nconfigure error: ParseAllTokens failed.\n'" } 
1.png

Best Regard,

Minh Hoa


Hoa Ngo

unread,
Nov 12, 2024, 4:26:20 AM11/12/24
to bareos-users
On Monday, November 11, 2024 at 4:09:16 PM UTC+7 Jörg Steffens wrote:
On 11.11.24 at 03:41 wrote Hoa Ngo:
> My REST-API server uses Bareos user with admin rights,

I doubt that this user has sufficient permissions.
What user do you use to authenticate and what is his configuration?
(in "bconsole" type the command "show console" or "show
console=<username>"). In doubt also the profile configuration ("show
profile").
Be aware, that the "operator" and "webui-admin" profile do not have
sufficient permissions for this.

Regards,
Jörg



> I read the BareOS Rest API modification guide and followed it but I
> can't create schedules through the API
> Could you check it over and fix it for me?
>
> 1.png2.png
> Best regards,
>
> Minh Hoa
>
> --
> You received this message because you are subscribed to the Google
> Groups "bareos-users" group.
> To unsubscribe from this group and stop receiving emails from it, send

Hoa Ngo

unread,
Nov 12, 2024, 4:26:20 AM11/12/24
to bareos-users
On 11.11.24 at 03:41 wrote Hoa Ngo:
> My REST-API server uses Bareos user with admin rights,

I doubt that this user has sufficient permissions.
What user do you use to authenticate and what is his configuration?
(in "bconsole" type the command "show console" or "show
console=<username>"). In doubt also the profile configuration ("show
profile").
Be aware, that the "operator" and "webui-admin" profile do not have
sufficient permissions for this.

Regards,
Jörg



> I read the BareOS Rest API modification guide and followed it but I
> can't create schedules through the API
> Could you check it over and fix it for me?
>
> 1.png2.png
> Best regards,
>
> Minh Hoa
>
> --
> You received this message because you are subscribed to the Google
> Groups "bareos-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
Reply all
Reply to author
Forward
0 new messages