Hello BigFix Forum. I am hoping for some assistance in understanding and utilizing aspects of the API.
My overall objective is to automate the uploading of a file (jar file in this specific case) to BF’s _Upload directory and create an action to send it out to some targets (that exist in pre-defined groups).
I had thought to make use of /api/upload and /api/action to get the job however, I may have misunderstood /api/upload.
$FilePath = "TEST_FILE.txt"
$body = ""
$global:uploadResult = Invoke-RestMethod -Credential $Credential -Uri https://b1p1-wbfxap01:52311/api/upload -Headers $headers -Method POST -InFile $FilePath -ContentType 'multipart/form-data' -ErrorAction SilentlyContinue -ErrorVariable uploadError -OutVariable uploadResult
My attempts at using /api/upload have managed to put my test file into the Master Action Site’s “Files” container. I was using the MO account in an attempt to work around some current access issues but going forward this would NOT be the case. It was the location of the file that surprised me. I was "ass"uming it would end up under \BES Server\wwwrootbes\Uploads.
Using get /api/uploads I get a return of all of my files under \BES Server\wwwrootbes\Uploads so it seemed that if I used it to POST that is where it would go.
Should I even be using /api/upload to put a file into \BES Server\wwwrootbes\Uploads or should I use a script to copy my file from source to the Uploads directory using it’s SHA1 as the directory?
Am I even on the correct path for getting where I want to be?