-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
possibility to GET Custom_fields from API #1841
Comments
To add to this, the idea is that custom fields with a type of I do not believe this should introduce any other API functionality surrounding custom fields. |
@PacketBucket Could you please provide an example API request and response illustrating the functionality being proposed? |
I asked for this as well in #1792. As a concrete proposal I could imagine an endpoint https://netbox/api/ipam/ip-addresses/_choices/, which would return all the possible values with their respective key in a format similar to https://netbox/api/ipam/_choices/. |
Maybe i would have two proposals and we can agree on what is more suitable for us. As custom fields are defined on one place https://netbox/admin/extras/customfield/ This is approximate model what I would imagine as output, it is yaml just for better reading ---
hostname:
required: true
type: Text
values:
models:
- ipaddress
status_scan:
required: false
type: Boolean
values:
models:
- ipaddress
- prefix
owner:
required: true
type: Selection
values:
- value: ICT
label: 12
- value: Finance
label: 31
models:
- prefix
- ipaddress
- vlan
anything:
required: false
type: Text
values:
models:
- ipaddress
- device Second thought is more the same as _choice in every API item or how to say... (circuit, dcim, extras, ..., virtualization), every such an item would have its own /customfield/ and output would give us all custom fields according models defined in objects for each custom field in /admin/extras/customfield/. Custom Field "owner" Custom Field "anything" using GET from https://netbox/api/ipam/customfield/ would return both custom fields above as both have objects ipam in it, ---
owner:
required: true
type: Selection
values:
- value: ICT
label: 12
- value: Finance
label: 31
models:
- prefix
- ipaddress
- vlan
anything:
required: false
type: Text
values:
models:
- ipaddress
- device on other hand https://netbox/api/dcim/customfield/ would return just "anything" custom field ---
anything:
required: false
type: Text
values:
models:
- ipaddress
- device as i now got all those info together, i think first proposal does make me more sense, and that just from one reason, to have all fields available from one url. Just let me know your thoughts, ideas. |
Issue type
[ x] Feature request
[ ] Bug report
[ ] Documentation
Environment
Python 2.7.12
Netbox 2.2.8
Description
As there is possible to define a lot of IPAM Custom_Fields, it would be useful to have also possibility to GET all those key/value/label back from API, same as static_choice.
Use case:
I have YAML file which can POST new IP records in batch, i need to define the Custom_Fields for every record. But i am not able to define which value corresponds with which label, therefore i would like to make a GET call for it before and then i can see which value is what label and can complete YAML file with proper Custom_Fields values.
The text was updated successfully, but these errors were encountered: