- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Using API to create a new python script
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2019 06:25 AM
Hi, trying to use API to create / update a script in NetMRI so that I can automate the process of uploading the script from my local machine to NetMRI.
When I do the post before (pseudo code from PostMan), the script gets created, but does not have a Name.
Re: Using API to create a new python script
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2019 07:24 AM
I have this call out myself just now, and it fails, but in looking at the output it seems to think the script_file type is an array and not a string. Try it as an array instead and see if that works.
<response> <error>general/validation-failed</error> <message> Validation failed: Script file Invalid import file: missing script name </message> <fields type="hash"> <script_file type="array"> <string>Invalid import file: missing script name</string> </script_file> </fields> </response>
Re: Using API to create a new python script
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2019 07:50 AM
Thanks for the quick reply.
Which one did you try and get the error on, the create or the update?
My create is working ok, other than it doesn't have the name when I look at the scripts page in the GUI.
When I do a create with this JSON:
It works, I get back HTTP 200, and this is what I get for a response. You can see the Name is "".
{ "script": { "category": "Uncategorized", "created_at": "2019-07-19 10:41:00", "created_by": "svcnpmauto1", "description": "", "id": 190, "language": "Python", "module": "CCS", "name": "", "read_only": false, "risk_level": 1, "target_mapping": "device", "taskflow_create": "device\/standard", "taskflow_edit": "device\/standard", "taskflow_revert": null, "transactional_ind": false, "updated_at": "2019-07-19 10:41:00", "updated_by": "svcnpmauto1", "visible": true, "script_variables": [], "_class": "Script" } }
When I do an update with this JSON:
Re: Using API to create a new python script
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2019 08:07 AM
I was just popping it into my browser and trying it. I can't troubleshoot this more today, but can try and look at it later. You might also try posting this in the Infoblox NetMRI Slack site.
Thanks.