We are trying to create build definition by copy another build definition information using Azure Devops Rest API however getting the below error:
HttpError BadRequest - Value cannot be null. Parameter name: definition.Repository.Mappings.Mapping.ServerPath.
Here are the steps we are following
- Get the build information using API - This step is working fine
- Modify the name of the build definition
- Create the new build definition by passing the above build definitions request Body
Sample code
var buildDefinitionGet = client.GetBuildDefinitionsAsync("XXX.DevOps", "15");
var newBuildDefinition = buildDefinitionGet;
newBuildDefinition.name = "MVC2017-1";
var buildDefinition = await client
.CreateBuildDefinitionsAsync("XXX.DevOps", newBuildDefinition)
.ConfigureAwait(false);
Here is the request body structure:
public class BuildDefinitionRequestBody
{
public Process process { get; set; }
public Repository repository { get; set; }
public ProcessParameters processParameters { get; set; }
public List<object> drafts { get; set; }
public Queue queue { get; set; }
public string name { get; set; }
public string type { get; set; }
public string queueStatus { get; set; }
}
We are using TFVC as source control.
Are we missing anything?