Attempting a PUT to the ReloadDataFile API (URL below) from Powershell using Invoke-RestMethod. I'm able to successful do it from Postman. From powershell, no matter what I attempt, I get the 405 - Method Not Allowed. Obviously, the PUT is allowed on this endpoint as it works from Postman.
When I replace the url, project Id, data file id, tenant ID, and auth, I have no issues on any of the other get/post requests, so that does not appear to be the issuel.
{{baseUrl}}/projects/:projectId/data-files/:dataFileId/file?TENANTID={{TENANTID}}
Here's what my current scripts looks like:
$FileName = "NewDataFile.zip";
$FileNameWithPath = "C:temp\NewDataFile.zip";
$URL = "">loadrunner-cloud.saas.microfocus.com/.../file
$fileBytes = [System.IO.File]::ReadAllBytes($FileNameWithPath);
$fileEnc = [System.Text.Encoding]::GetEncoding('UTF-8').GetString($fileBytes);
$boundary = [System.Guid]::NewGuid().ToString();
$LF = "`r`n";
$headers = @{
Authorization="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
accept="*/*";
ContenType = "multipart/form-data; boundary=--$boundary--"
}
$bodyLines = (
$fileEnc,
"--$boundary--$LF"
) -join $LF
Invoke-RestMethod -Method PUT $URL -H $headers -Body $bodyLines