0

I am currently trying to create a work item in my Azure Devops using the API. However, I keep running into a 400 error "You must pass a valid patch document in the body of the request.". Below is the javascript request that I am making. I am certain that the URL is correct. I have tried POST, using from: null in the json data. Does anyone have an idea why the error is occurring here? I am using the API version 5.0.

    const nData = [
              {
                "op": "add",
                "path": "/fields/System.Title",
                "value": "Sample task"
              }                   
            ];
const promise = $.ajax({
            url: url,
            type:'PATCH',
            contentType: "application/json-patch+json",
            dataType: 'json',
            data: nData,
            headers: {
                'Authorization': 'Basic ' + btoa("" + ":" + myPatToken)
            }
        });
Rob
  • 14,746
  • 28
  • 47
  • 65
TsTeaTime
  • 881
  • 1
  • 13
  • 34

0 Answers0