windows command prompt curl POST to run Azure DevOps pipeline

darkplume 注册会员
2023-01-26 10:35

I managed to solve my problem which consisted of numerous steps:

  1. Log the API call from the DevOps website to get the correct format of the json-body ( See this question ).
  2. Format the json-body with extra double quotation signs.
  3. Use the {project}-id instead of the ascii-name since it included a special character which the command prompt misinterpret.

Hence the complete curl command was:

curl -X POST -u : "https://dev.azure.com/{organization}/{project}/_apis/pipelines/{pipelineId}/runs?api-version=6.0-preview.1" -H "Content-Type: application/json" -d "{""ip"": ""[]"", ""resources"": {""repositories"": {""self"": {""refName"": ""refs/heads/master""}}}}"

About the Author

Question Info

Publish Time
2023-01-26 10:35
Update Time
2023-01-26 10:35

Related Question