Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3637

Azure Devops REST API - publish build artefacts from local

$
0
0

I'm trying to publish some files as build artefacts in an Azure DevOps build pipeline with PowerShell using this documentation:

https://learn.microsoft.com/en-us/rest/api/azure/devops/build/artifacts/create?view=azure-devops-rest-7.2#artifactresource

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?


Viewing all articles
Browse latest Browse all 3637

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>