PUT update a TeamCity Configuration Parameter working from PostMan but not from PS Script
$url = "https://teamcity.myserver.io/guestAuth/app/rest/buildTypes/id:SandboxPlayGround_WindowsForms1_Build/parameters/Version"
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-Type", 'text/plain')
$headers.Add("Origin", 'https://teamcity.myserver.io')
Invoke-RestMethod -Method Put -Uri $url -Headers $headers -Body "2.3.1.0"
Gives me error:
[19:54:59][Step 2/6] Invoke-RestMethod : HTTP Status 405 - Request method 'PUT' not supported
[19:54:59][Step 2/6]
[19:54:59][Step 2/6]
[19:54:59][Step 2/6]
[19:54:59][Step 2/6] type Status report
[19:54:59][Step 2/6] message Request method 'PUT' not supported
[19:54:59][Step 2/6] description The specified HTTP method is not allowed for the requested resource.
But I can update Parameter value using the same URL and Headers from PostMan just fine.
Where am I going wrong?
Please sign in to leave a comment.
Hi Ibrahim,
could you share a screenshot showing the postman details? There must be something missing in the PS script (or wrongly written) if it works one way and not the other.