Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while creating power outlet via API #7864

Closed
VictorPavlushin opened this issue Nov 18, 2021 · 1 comment
Closed

Error while creating power outlet via API #7864

VictorPavlushin opened this issue Nov 18, 2021 · 1 comment
Assignees
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@VictorPavlushin
Copy link

NetBox version

v3.0.8

Python version

3.9

Steps to Reproduce

If, when creating a power outlet via the API, pass a zero port power value ("power_port": null), an error is generated: {"power_port": ["This field may not be null."]}.
The documentation says:

power_port integer
          title: Power port
          x-nullable: true
# curl -X POST http://localhost:8001/api/dcim/power-outlets/ \ 
    -H 'Content-Type: application/json' \
    -H "Authorization: TOKEN 0000000000000000000000000000000000000" \
    -d '{"description": "", "device": 6660, "feed_leg": null, "label": "", "mark_connected": false, "name": "C13-1", "power_port": null, "tags": [], "type": "iec-60320-c13"}'
{"power_port":["This field may not be null."]}(venv)

# curl -X POST http://localhost:8001/api/dcim/power-outlets/  \
    -H 'Content-Type: application/json'  \
    -H "Authorization: TOKEN 0000000000000000000000000000000000000" \
    -d '{"description": "", "device": 6660, "feed_leg": null, "label": "", "mark_connected": false, "name": "C13-1", "tags": [], "type": "iec-60320-c13"}'
{"id":9160,"url":"http://localhost:8001/api/dcim/power-outlets/9160/","display":"C13-1","device":{"id":6660,"url":"http://localhost:8001/api/dcim/devices/6660/","display":"DEVICENAME","name":"DEVICENAME"},"name":"C13-1","label":"","type":{"value":"iec-60320-c13","label":"C13"},"power_port":null,"feed_leg":null,"description":"","mark_connected":false,"cable":null,"cable_peer":null,"cable_peer_type":null,"connected_endpoint":null,"connected_endpoint_type":null,"connected_endpoint_reachable":null,"tags":[],"custom_fields":{},"created":"2021-11-18","last_updated":"2021-11-18T12:24:21.206422+07:00","_occupied":false}

Expected Behavior

Successful device creation

Observed Behavior

Got out the error

@VictorPavlushin VictorPavlushin added the type: bug A confirmed report of unexpected behavior in the application label Nov 18, 2021
@VictorPavlushin
Copy link
Author

The same thing happens when you try to update the bullets with the PUT and PATCH methods /api/dcim/power-ports/{id} data: {"feed_leg": null, "power_port": null}

@jeremystretch jeremystretch added the status: accepted This issue has been accepted for implementation label Nov 18, 2021
@jeremystretch jeremystretch self-assigned this Nov 18, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

2 participants