我想访问选定工作项中的一些数据。
下面是我的工作代码。
function postApiData(ApiUrl,responseBody,token) {
var res = '';
$.ajax({
type: 'POST',async: false,url: ApiUrl,contentType: 'application/json',data: JSON.stringify(responseBody),cache: false,dataType: 'json',beforeSend: function (xhr) {
xhr.setRequestHeader("Authorization","Basic " + btoa("" + ":" + _token));
},}).done(function (data) {
res = data;
});
return res;
};
var d = {
"ids": itemlist,"fields": ["System.Id","System.WorkItemType","System.Title","System.AssignedTo","System.State","System.Tags","cust.PID","cust.Product","cust.ReleasedToProduction"]
};
var itemdata = postApiData('https://dev.azure.com/COMP/products/_apis/wit/workitemsbatch?$expand=relations&api-version=5.1',d,'');
但是,$ expand不能在这里建立关系。查询给出结果,并且始终忽略$ expand。
我也试图在请求正文中传递$ expand,但是它也不起作用。有人可以在这里指导吗?