Hi Dean,
Setting RaftItemType_Code = 7 in this instance worked for me. Appreciate the list of valid types. Thanks for all of your help!
Scott
Hi Dean,
Setting RaftItemType_Code = 7 in this instance worked for me. Appreciate the list of valid types. Thanks for all of your help!
Scott
Hi Dean,
Here is what I'm running:
Invoke-WebRequest -Method Post -Uri "https://<otter_server>/api/json/Rafts_CreateOrUpdateRaftItem" -Body @{
API_Key = "<apikey>"
Raft_Id = 1
RaftItemType_Code = 4
RaftItem_Name = "JobConfigs/test.yml"
ModifiedOn_Date = Get-Date
ModifiedBy_User_Name = "scusson"
Content_Bytes = [System.Convert]::ToBase64String([IO.File]::ReadAllBytes("D:\test.yml"))
}
If I add the text file (test.yml) thru the UI, it gets added as binary.
Thanks,
Scott
Hi,
This functionality is fixed in 2024.4. However, the script gets created as type "Unknown". How can this be set and what types are valid?
Thanks,
Scott
Hi Alana,
I updated my instance to 2024.2 and still get the same error.
Thanks,
Scott
Hi,
Thanks for the example. However, I still get the error 'Invalid value for "Content_Bytes": Invalid cast from 'System.String' to 'Inedo.Data.VarBinaryInput'' with this body:
API_Key = "xxxxx"
Raft_Id = 1
RaftItemType_Code = 4
RaftItem_Name = "JobConfigs/test.yml"
ModifiedOn_Date = Get-Date
ModifiedBy_User_Name = "scusson"
Content_Bytes = [System.Convert]::ToBase64String([IO.File]::ReadAllBytes("D:\foo\bar\test.yml"))
It appears that the .yml is being detected as binary?
Scott
Hi,
I'm on 2024.1. In this instance, I use Add Script->Upload Scripts & Assets because I already have the file on disk. I will use the "Create a Blank Script" method as a workaround.
Also, can you provide an example of uploading a file from disk?
Thanks!
Scott
Hi,
When I try your example, I get the error 'Invalid value for "Content_Bytes": Invalid cast from 'System.String' to 'Inedo.Data.VarBinaryInput''.
Also, when I add a text file under Scripts, in my case .yml, it gets added as binary. I can't see a way to change this.
Thanks,
Scott
@atripp Hi Alana. Thanks! I'll try it out.
Hi,
Since Otter does not have a native api to upload a script, can we get a working example for Rafts_CreateOrUpdateRaftItem to perform this action to a subfolder? Our goal is to have an automated job push a script upon success.
Thanks,
Scott