I am trying to upload one file to BitBucket repository (Git system). I am trying to send that using the REST API but the error Indicates that POST method is not allowed, although I can of course using the "git push" command to send new files. But if I try to POST the file I am getting this error: "HTTP Status 405 – Method Not AllowedType Status ReportMessage Request method POST not supported"
I am trying to that with this code:
$API_KEY="NDU2"
$uri="https://bitbucket.dev/projects/TEST/repos/faselect/browse/test"
$jsonFile=Get-Content -Raw -Pat C:\Users\john\Downloads\test1.json
Invoke-RestMethod -Uri $uri -Headers @{Authorization="$("Basic {0}" -f $API_KEY)"} -Method Post -Body $jsonFile -ContentType 'application/json'