-
Notifications
You must be signed in to change notification settings - Fork 19
Unable to query zones with a specific view name from the API. #171
Comments
Hi @jcollie, thanks for raising this issue. The issue with addressing a view by its name in API queries is even a bit more tricky than you already found: Views are entirely optional for zones, so it's possible that there is not even a view that could be selected by a name. The main reasons for this are backward compatibiity, the fact that many users don't need views at all, and the fact that views are also optional in the configuration of BIND, which would otherwise be hard to map to NetBox DNS. Currently the best solution is to do a two-step approach (as you already found out) and determine the ID of the view you want to query for, then in a second step get the zones for that view. Zones without a view are in this case addressed by I'll look a bit deeper into this and try to find a way to enhance the Serializer code to accept view_name as well. Good point in any case, the two-step approach is a bit tedious indeed. |
OK, forget about the idea I outlined above, that wasn't the cause of the problem. I'm still trying to find out what happens. |
This was, after all, nothing but a stupid C&P error ... sorry for that. Fixed in the latest version of the PR. |
Short test with some similar code to yours:
When using pynetbox it doesn't seem to be such a good idea to name a view "null" :-) The results:
Seems to do exactly what it should now, even with zones without views. |
I am unable to query zones by view name using the API:
Gives me:
But:
gives me:
Using the
view_id
parameter works as well:gives me:
The text was updated successfully, but these errors were encountered: