§I have been working with the TFS API that on the Microsoft website. According to the API documentation, here , I should be able to create a TFS workitem by sending a PATCH request with this type of request
https://{instance}/DefaultCollection/{project}/_apis/wit/workitems/${workItemTypeName}?api-version={version}
and I make the data
object in the AJAX request this:
[{
"op": "add",
"path": { string }
"value": { string or int, depending on the field }
}]
However, when I create the PATCH request with AJAX using a IIS Express server, I get a 404 Not Found Error
.
I have no idea why this would be the case.
Check my example below, I've created a task work item named cecetest1 successfully with the following request:
var jsonObj = [{
"op": "add",
"path": "/fields/System.Title",
"value": "cecetest1"
}];
$.ajax({
url: 'http://tfsserver:8080/tfs/TeamProjectCollection/TeamProject/_apis/wit/workitems/$Task?api-version=1.0',
type: 'PATCH',
contentType: "application/json-patch+json",
data: JSON.stringify(jsonObj),
cache: false,
dataType: 'json',
beforeSend: function (xhr) {
xhr.setRequestHeader("Authorization", "Basic " + btoa("domain\\username" + ":" + "password"));
},
})