Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

Working Rafts_CreateOrUpdateRaftItem example for Otter



  • 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


  • inedo-engineer

    Hi @scusson_9923 ,

    Here's a one-liner that should hopefully get you started.

    Invoke-WebRequest -Method Post -Uri "http://otter.localhost/api/json/Rafts_CreateOrUpdateRaftItem" -Body @{
        API_Key = "abc123"
        Raft_Id = 1
        RaftItemType_Code = 4
        RaftItem_Name = "mypath/myscript.ps1"
        ModifiedOn_Date = Get-Date
        ModifiedBy_User_Name = "API"
        Content_Bytes = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("'hello world'"))
    }
    

    The RaftItemType_Code=4 is not documented, but it's a fixed value and means a script. I recommend creating the item manually first, then looking in the RaftItems table for the Raft_Id and RaftItemType_Code values.

    Cheers,
    Alana


Log in to reply
 

Inedo Website HomeSupport HomeCode of ConductForums GuideDocumentation