I'm trying to publish some files as build artefacts in an Azure DevOps build pipeline with PowerShell using this documentation:
My powershell looks like this:
$url = "https://dev.azure.com/<org>/<project>/_apis/build/builds/<buildId>/artifacts?api-version=7.2-preview.5"$body = @{ name = 'testpublish' resource = @{ data = "./testfolder/*" type = "filepath" }}$headers = @{'Authorization' = "Basic " + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":<pat>"))'Content-Type' = 'application/json'}$response = Invoke-RestMethod -Uri $url -Method Post -Headers $headers -Body $body
however, I'm getting error:
Invoke-RestMethod:{"$id": "1","innerException": null,"message": "TF400898: An Internal Error Occurred.","typeName": "Newtonsoft.Json.JsonReaderException, Newtonsoft.Json","typeKey": "JsonReaderException","errorCode": 0,"eventId": 0}
Could someone point me to the correct syntax, and let me know if I'm missing anything please?