You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I chanced in issuing idoitcli create file/"Patches MYHOST_2011-05-03.txt"
The file entry showed up in idoit. But how do I upload the file via idoitcli?
Expected behavior
idoitcli list or idoitcli create -h should show some hints how to upload files to idoit. From using the API, I know that there would be 3 steps:
create the file object (that I did)
upload the file content (cmdb.category.create)
link the file to MYHOST (also cmdb.category.create)
Actual behavior
There are no hints available how to achieve this.
Steps to reproduce the behavior
Get a file and try to upload 😁
idoitcli create file/"Patches MYHOST_2011-05-03.txt" creates a File object named "Patches MYHOST_2011-05-03.txt" inside idoit
idoitcli create ??? uploads the file content
idoitcli create ??? joins the file to another object, like a Server object
I'm sorry if I missed available docs, but I've been too thick to find them. 😞
Sorry for the late reply. Uploading files is currently not supported by idoitcli. But it makes sense to implement this feature because – like you wrote – the i-doit JSON-RPC API is able to upload base64 encoded files. My idea is to add a new command called upload:
The optional option --object assigns the file to an object identified by its title or identifier.
The other optional option --new enforces to create a new file object before uploading. Otherwise, it will try to identify an existing file object by the title file.txt.
Hello Benjamin,
I think this is great. Currently I'm building my own JSON query and using idoitcli call "$MYQUERY" to do it.
Maybe you can include the possibility to add the uploaded file as a new version to an already existing file object? Like, I created a file object (cmdb.object.create 'C__OBJTYPE__FILE) named "Patchlist myhost" and upload the new files as versions now (cmdb.category.create, C__CMDB__SUBCAT__FILE_VERSIONS). My files are named hostname_timestamp.txt, so I use the hostname to find "Patchlist $hostname" and add version "$timestamp". This would better be extra parameters though...
BTW, I found out (by replaying the samples from the API sample page) that I even don't need to include my apikey since idoitcli adds it if it's missing. This is a noteable feature since it allows better sharing of scripts using idoitcli 👍
Activity
bheisig commentedon Jun 26, 2019
Hello Werner,
Sorry for the late reply. Uploading files is currently not supported by
idoitcli. But it makes sense to implement this feature because – like you wrote – the i-doit JSON-RPC API is able to upload base64 encoded files. My idea is to add a new command calledupload:The optional option
--objectassigns the file to an object identified by its title or identifier.The other optional option
--newenforces to create a new file object before uploading. Otherwise, it will try to identify an existing file object by the titlefile.txt.What do you think?
wernerflamme commentedon Jun 27, 2019
Hello Benjamin,
I think this is great. Currently I'm building my own JSON query and using
idoitcli call "$MYQUERY"to do it.Maybe you can include the possibility to add the uploaded file as a new version to an already existing file object? Like, I created a file object (cmdb.object.create 'C__OBJTYPE__FILE) named "Patchlist myhost" and upload the new files as versions now (cmdb.category.create, C__CMDB__SUBCAT__FILE_VERSIONS). My files are named hostname_timestamp.txt, so I use the hostname to find "Patchlist $hostname" and add version "$timestamp". This would better be extra parameters though...
BTW, I found out (by replaying the samples from the API sample page) that I even don't need to include my apikey since idoitcli adds it if it's missing. This is a noteable feature since it allows better sharing of scripts using idoitcli 👍