Click here to Skip to main content
14,454,989 members
Rate this:
Please Sign up or sign in to vote.
See more:
Unable to Create the Azure devops pipeline using REST Api call with .net code with c#
with out using integrated tool of VSTS

What I have tried:

httpWebRequest.ContentType = "application/json";
httpWebRequest.Method = "POST";

//passing PAT token in the header

httpWebRequest.Headers["Authorization"]= "Basic" + Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes($"{personalaccesstoken}:{personalaccesstoken}"));

using (var streamWriter = new

StreamWriter(httpWebRequest.GetRequestStream()))
{
//ASCIIEncoding.ASCII.GetBytes("")

string json = "";
streamWriter.Write(json);
}
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
var result = streamReader.ReadToEnd();
}

//Request Body

    {
    "definitionId": 1,
    "description": "test release",
    "artifacts": [
    {
    "alias": "_ApplicationName",
    "instanceReference": {
    "id": "GUID",
    "name": "Environment like Dev OR QA "
    }
    }
    ],
    "isDraft": false,
    "reason": "none",
    "manualEnvironments": null
    }

//once i run the code in the postman i am getting the repose as 200 Ok

//but when i check, release is not creating

//Please help me out how to proceed and need to creating Release pipeline through .net code
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100