How to assign the correct "assigned_object_type" to Journal #15551
Replies: 2 comments 5 replies
-
If you were using the Django ORM you could. But here it looks like you're using the REST API (I'm presuming nb = pynetbox), in which case it's just JSON. What type of object are you passing in as "nb_object" ? |
Beta Was this translation helpful? Give feedback.
5 replies
-
|
Closing discussion |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi
I need to create journals for various objects in Netbox, but I am in need of a good way to obtain the value for the required field "assigned_object_type" before I can create the journal.
Initially I thought it was enough the assign an existing object for the journal I want to create, but you have to set the type manually as well. My hope was that the journal creation process, could get the type based on the object assigned, but no such luck, so how do I assign the correct value dynamically?
E.g. if a journal needs to be created on a virtual cluster, the type value should be "virtualization.cluster", for a VM it must be "virtualization.virtualmachine" or for a device it must be "dcim.device"
I am trying to create function that will check for a specific tag with a journal, in order to check how long ago that journal was created and I would very much like to not have to make a function for each journal type:
Below works for VM's, but I would like to use the function for other objects in Netbox as well, like clusters, devices and others.
Netbox version: v3.6.9
Beta Was this translation helpful? Give feedback.
All reactions