netbox-community / go-netbox

The official Go API client for Netbox IPAM and DCIM service.
Other
199 stars 157 forks source link

GET site list details with custom field #125

Closed ram-memx closed 1 year ago

ram-memx commented 2 years ago

Hi All. I am pretty new to use golang client for netbox. I am trying to get the site list from Netbox and I would like to filter it using a custom field. Can you please let me know how to pass that custom field to "dcim.NewDcimSitesListParams()" function? Are custom fields supported using golang client? If not please let me know the best way to achieve this functionality. Thanks

dechristopher commented 2 years ago

Also looking to do such things. If there's no info I might just open a PR soon implementing it.

dechristopher commented 2 years ago

Looks like the NetBox REST API doesn't support providing custom field parameters. We're out of luck until that's added to the API. For now, we'll need to do client-side filtering to weed out devices that don't have the field values we're looking for.

v0ctor commented 1 year ago

Closing, as it is a limitation of the Netbox API.

tgoff commented 1 year ago

It appears this is supported now in the netbox REST API: https://demo.netbox.dev/static/docs/rest-api/filtering/#filtering-by-custom-field

edit: Opened a new ticket, which is linked below