API: cannot create virtual machine due to cluster required error while filled in. #5183

Closed
opened 2025-12-29 19:25:13 +01:00 by adam · 2 comments
Owner

Originally created by @dannylifino on GitHub (Aug 16, 2021).

NetBox version

v2.9.8

Python version

3.9

Steps to Reproduce

Make a POST api call to /virtualization/virtual-machines/ with data down below.

Array ( [name] => vps131.servername.com [cluster] => 2 )

Expected Behavior

The virtual machine to be created, because the required fields name and cluster are filled in.

Observed Behavior

The cluster field is required is the error it gives. This is some weird behaviour since the name in the request is found, but the cluster is not.

Client error: POST api/virtualization/virtual-machines/ resulted in a 400 Bad Request response:
{"cluster":["This field is required."]}

If i remove the name field from the request, it will also show: the name field is required.

Originally created by @dannylifino on GitHub (Aug 16, 2021). ### NetBox version v2.9.8 ### Python version 3.9 ### Steps to Reproduce Make a POST api call to /virtualization/virtual-machines/ with data down below. `Array ( [name] => vps131.servername.com [cluster] => 2 ) ` ### Expected Behavior The virtual machine to be created, because the required fields name and cluster are filled in. ### Observed Behavior The cluster field is required is the error it gives. This is some weird behaviour since the name in the request is found, but the cluster is not. Client error: `POST api/virtualization/virtual-machines/` resulted in a `400 Bad Request` response: {"cluster":["This field is required."]} If i remove the name field from the request, it will also show: the name field is required.
adam closed this issue 2025-12-29 19:25:13 +01:00
Author
Owner

@sdktr commented on GitHub (Aug 16, 2021):

Can you try and reproduce your request against demo.netbox.dev? If reproducable there, please post the curl request other people can try. Your current request is from a higher level language then the raw json that goes over the wire.

@sdktr commented on GitHub (Aug 16, 2021): Can you try and reproduce your request against demo.netbox.dev? If reproducable there, please post the curl request other people can try. Your current request is from a higher level language then the raw json that goes over the wire.
Author
Owner

@jeremystretch commented on GitHub (Aug 16, 2021):

Array ( [name] => vps131.servername.com [cluster] => 2 )

This isn't JSON data. Please see the REST API documentation for examples of valid API requests.

@jeremystretch commented on GitHub (Aug 16, 2021): > `Array ( [name] => vps131.servername.com [cluster] => 2 )` This isn't JSON data. Please see the [REST API documentation](https://netbox.readthedocs.io/en/stable/rest-api/overview/) for examples of valid API requests.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5183