We're trying to send an alert to JSM from Bitbucket Pipelines but receiving a "401 Unauthorized" error. Has anyone had any success authenticating from Bitbucket Pipelines to the JSM API using Powershell? Any ideas what I'm missing?
Pipeline code:
- $PAIR = [System.Text.Encoding]::UTF8.GetBytes("$env:API_USER:$env:API_TOKEN")
- $HEADER = @{"Authorization" = "Basic " + [System.Convert]::ToBase64String($PAIR)}
- Invoke-RestMethod -Method Post -ContentType 'application/json' -Uri "https://api.atlassian.com/jsm/ops/api/xxxxxxxxxxxxxxxxxxxxxxxxxx/v1/alerts" -Headers $HEADER -Body '{ "message":"Deployment failed - Test", "responders":[ { "id":"xxxxxxxxxx", "type":"team" } ], "visibleTo":[ { "id":"xxxxxxxxxx", "type":"team" } ], "alias":"test3", "description":"Deployment test", "priority":"P1" }'Triggers 401 Unauthorized:
