Skip to content

API requires status field set to create a new branch #225

@jchambers2012

Description

@jchambers2012

Plugin Version

0.5.2

NetBox Version

4.1.8

Python Version

3.12

Steps to Reproduce

Discussion #173

Send a post to the rest API to create a new branch without the status

{
    "name": "my-new-branch",
}

Or send a create command via pynetbox

nb.plugins.branching.branches.create(name=branch_name)

Expected Behavior

API should default new branched as new like Web GUI when field is missing from API
https://github.com/netboxlabs/netbox-branching/blob/main/netbox_branching/models/branches.py#L63

Observed Behavior

API Requires the status field to the set otherwise you get the following error messages:

Via API:

{
    "status": [
        "This field is required."
    ]
}

Via pynetbox

pynetbox.core.query.RequestError: The request failed with code 400 Bad Request: {'status': ['This field is required.']}

Errors can be bypassed by sending the status to newly as part of the API call:

Via API:

{
    "name": "my-new-branch",
    "status": "new"
}

Via pynetbox:

nb.plugins.branching.branches.create(
                name=branch_name  , status="new"
            )

Metadata

Metadata

Assignees

Labels

severity: lowDoes not significantly disrupt application functionality, or a workaround is availablestatus: acceptedtype: bugA confirmed report of unexpected behavior in the application

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions