API Definitions for available-ips and available-prefixes are incorrect #3717

Closed
opened 2025-12-29 18:30:44 +01:00 by adam · 2 comments
Owner

Originally created by @jbliao on GitHub (May 21, 2020).

Originally assigned to: @DanSheps on GitHub.

Change Type

[ ] Addition
[x] Correction
[ ] Deprecation
[ ] Cleanup (formatting, typos, etc.)

Area

[ ] Installation instructions
[ ] Configuration parameters
[ ] Functionality/features
[x] REST API
[ ] Administration/development
[ ] Other

Proposed Changes

I'm writing a ipam project with go-netbox(https://github.com/kobayashi/go-netbox for v2.8), which generate the client from swagger. And I'm using the prefix/available-ips api to create unused ip address. I notice that the api documents in http://netbox/api/docs/ has difference with actually code:

These mismatches make go-netbox client unable to work correctly. I would appreciate if this can be fixed.

Originally created by @jbliao on GitHub (May 21, 2020). Originally assigned to: @DanSheps on GitHub. <!-- NOTE: IF YOUR ISSUE DOES NOT FOLLOW THIS TEMPLATE, IT WILL BE CLOSED. Please indicate the nature of the change by placing an X in one of the boxes below. --> ### Change Type [ ] Addition [x] Correction [ ] Deprecation [ ] Cleanup (formatting, typos, etc.) ### Area [ ] Installation instructions [ ] Configuration parameters [ ] Functionality/features [x] REST API [ ] Administration/development [ ] Other <!-- Describe the proposed change(s). --> ### Proposed Changes I'm writing a ipam project with go-netbox(https://github.com/kobayashi/go-netbox for v2.8), which generate the client from swagger. And I'm using the prefix/available-ips api to create unused ip address. I notice that the api documents in http://netbox/api/docs/ has difference with actually code: * The request model should be IPAddress rather than WritablePrefix _ref: https://github.com/netbox-community/netbox/blob/v2.8.3/netbox/ipam/api/views.py#L211_ * The return code should be 201 rather than 200 _ref: https://github.com/netbox-community/netbox/blob/v2.8.3/netbox/ipam/api/views.py#L218_ These mismatches make go-netbox client unable to work correctly. I would appreciate if this can be fixed.
adam added the type: bugstatus: accepted labels 2025-12-29 18:30:44 +01:00
adam closed this issue 2025-12-29 18:30:45 +01:00
Author
Owner

@DanSheps commented on GitHub (May 21, 2020):

You are correct in that it should be IPAddress instead of WritablePrefix, however you are incorrect in the return code. The return code should be 201, however the proper response should still be 201 as it is "created"

@DanSheps commented on GitHub (May 21, 2020): You are correct in that it should be IPAddress instead of WritablePrefix, however you are incorrect in the return code. The return code should be 201, however the proper response should still be 201 as it is "created"
Author
Owner

@jbliao commented on GitHub (May 21, 2020):

Yeah, the return code should be 201. And that is what I said above. The problem is that the api doc told me to use 200 as the success code.
I think this line may be the cause
c507ab30e9/netbox/ipam/api/views.py (L164)

@jbliao commented on GitHub (May 21, 2020): Yeah, the return code should be 201. And that is what I said above. The problem is that the api doc told me to use 200 as the success code. I think this line may be the cause https://github.com/netbox-community/netbox/blob/c507ab30e97bcb3e2f503a9e6d9558f6a4cb25aa/netbox/ipam/api/views.py#L164
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3717