Created
November 26, 2019 13:38
-
-
Save adamdriscoll/4da118ca9b321602e2fac4c477beb2af to your computer and use it in GitHub Desktop.
Upload a file via REST API in UD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-UDRestApi | Stop-UDRestApi | |
$Endpoint = New-UDEndpoint -AcceptFileUpload -Url "/process" -Method "POST" -Endpoint { | |
param($File) | |
Write-UDLog "GOT A FILE!" | |
$filepath = "C:\temp\dev\testdash\" | |
$filename = New-Item -Path $filepath -Name "$(get-random).txt" | |
if (!($File)) { | |
throw "file is empty." | |
} | |
Set-Content -Path $filename -Value $File -Encoding Byte | |
Write-UDLog "POST REQUEST reccieved, with FILE" | |
} | |
Start-UDRestApi -Endpoint $Endpoint -Port 8083 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment