-
Python 3.9.2 | Django 3.2.9 | NetBox 3.0.10 I'm trying to call my custom scripts via the REST API, and in the documentation you explain how to pass simple form variables, but I'm rather stuck when it comes to objects. I'm trying to pass a device object to my custom script in python via the API, tried to squeeze the whole device dict into the data JSON, also tried passing only the device ID but in both cases the custom script fails to pick up attributes of the expected object. It might also be possible that I have something dodgy in my python code, so pasted the relevant part below:
Probably for others' benefit as well, it might be useful to call out on the doc page if there are any tips or tricks as most people I think will use objects in their custom scripts. Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
Can you show how |
Beta Was this translation helpful? Give feedback.
-
For the github discussion's sake: the feature is missing, but it is possible to work it around by passing the ID under another key in "data" when calling the API. If that key is present, lookup should be done before trying to do anything with the host object. |
Beta Was this translation helpful? Give feedback.
For the github discussion's sake: the feature is missing, but it is possible to work it around by passing the ID under another key in "data" when calling the API. If that key is present, lookup should be done before trying to do anything with the host object.