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

Prefix length error while adding child prefixes #2181

Closed
JSystem1 opened this issue Jun 19, 2018 · 1 comment
Closed

Prefix length error while adding child prefixes #2181

JSystem1 opened this issue Jun 19, 2018 · 1 comment

Comments

@JSystem1
Copy link

Issue type

[ ] Feature request
[X ] Bug report
[ ] Documentation

Environment

  • Python version: 2.7
  • NetBox version: 2.3.2

When trying to POST a child prefix to the following endpoint api/ipam/prefixes/(parent-prefix)/available-prefixes

You get the following error complaining about prefix length:
<pre><strong>&lt;type &#39;exceptions.KeyError&#39;&gt;</strong><br /> u&#39;prefix_length&#39;</pre>

The following is the json I am passing

{ "prefix": "ip/29", "status": { "value": 1, "label": "Active" } }

Description

@jeremystretch
Copy link
Member

jeremystretch commented Jun 29, 2018

The point of the /available-prefixes/ endpoint is that it will automatically provision the next available prefix: You just have to specify the size (prefix_length) in the request. If you want to provision a specific prefix, use the /api/ipam/prefixes/ endpoint. (Also, you only need "status": 1 for the status field.)

That said, the API should return a validation error rather than an exception if prefix_length is missing from the POSTed data.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants