I’m working to setup some Powershell to post some results to TestRail. I am aware of the PSTestRail but I was hoping to avoid using that since it relies on the TestRail DLL’s. I would rather directly interact with API, if possible.
I have the following portion to do the connection but it fails to connect complaining about the user/password, Authentication failed: invalid or missing user/password or session cookie.
I have verified the user email is correct and I am using an API key which is also correct.
This method of connecting to an API works on other products I’ve written scripts for. So just trying to figure out why this isn’t working.
$ProjectId = 1 $getMSUrl = $TestRailUrl, "get_milestones", $ProjectId -join "/" $BUser = "[useremail]" $BPwd ="[APIKEY]" $secpwd = ConvertTo-SecureString $BPwd -AsPlainText -Force $creds = New-Object System.Management.Automation.PSCredential($BUser,$secpwd) $rtrnVal = Invoke-RestMethod -Uri $getMSUrl -ContentType application/json -Credential $creds -ErrorAction Stop