Unable to assign interface to IP address via API #1889

Closed
opened 2025-12-29 17:20:05 +01:00 by adam · 1 comment
Owner

Originally created by @explody on GitHub (Aug 2, 2018).

Environment

  • Python version: 3.6.5, 3.5.x
  • NetBox version: 2.4-beta1

Steps to Reproduce

Using the API, attempt to PUT or PATCH an existing IP address including an interface id.

postman CURL output. Both IP and iface ID #'s exist and are correct
curl -X PATCH \
  https://ourhost/api/ipam/ip-addresses/11111/ \
  -H 'authorization: Token XXXX' \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -H 'postman-token: XXXX' \
  -d '{
    "interface": 2222
}'

Expected Behavior

The IP would now be assigned to the given interface.

Observed Behavior

From postman, the following error:

{
    "interface": {
        "non_field_errors": [
            "Invalid data. Expected a dictionary, but got int."
        ]
    }
}

We additionally tried to pass interface data as a nested hash, but encountered a variety of other errors. It appears that the shown approach should work, so this may hint at the base problem.

Originally created by @explody on GitHub (Aug 2, 2018). <!-- NOTE: This form is only for reproducible bugs. If you need assistance with NetBox installation, or if you have a general question, DO NOT open an issue. Instead, post to our mailing list: https://groups.google.com/forum/#!forum/netbox-discuss Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report. --> ### Environment * Python version: 3.6.5, 3.5.x * NetBox version: 2.4-beta1 <!-- Describe in detail the steps that someone else can take to reproduce this bug using the current stable release of NetBox (or the current beta release where applicable). --> ### Steps to Reproduce Using the API, attempt to PUT or PATCH an existing IP address including an interface id. ``` postman CURL output. Both IP and iface ID #'s exist and are correct curl -X PATCH \ https://ourhost/api/ipam/ip-addresses/11111/ \ -H 'authorization: Token XXXX' \ -H 'cache-control: no-cache' \ -H 'content-type: application/json' \ -H 'postman-token: XXXX' \ -d '{ "interface": 2222 }' ``` <!-- What did you expect to happen? --> ### Expected Behavior The IP would now be assigned to the given interface. <!-- What happened instead? --> ### Observed Behavior From postman, the following error: ``` { "interface": { "non_field_errors": [ "Invalid data. Expected a dictionary, but got int." ] } } ``` We additionally tried to pass interface data as a nested hash, but encountered a variety of other errors. It appears that the shown approach should work, so this may hint at the base problem.
adam added the type: bugstatus: accepted labels 2025-12-29 17:20:05 +01:00
adam closed this issue 2025-12-29 17:20:06 +01:00
Author
Owner

@jeremystretch commented on GitHub (Aug 3, 2018):

Fixed in #2300. Thanks @explody!

@jeremystretch commented on GitHub (Aug 3, 2018): Fixed in #2300. Thanks @explody!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#1889