I am trying to use the countTasksIndexed service from “Using the Task Engine RESTful Web Services” chapter of the “Task Engine API and Service Reference” document in a custom gadget as below
URLS : {
TASK_LIST_COUNT_POST : {url:'/rest/pub/opentasksearch/count',method:'POST',isArray:true ,serverType:SERVER_TYPES.TE},
},
defineScope: function() {
try {
var _this = this;
this.$scope.getTaskCounts = function(gadgetConfig){
var query ={}; query["includeTaskData"]=true; //query["pageSize"]=32;query["pageNum"]=1;
var terms = [];
terms.push({"termName": "taskID","operator":"=","termValue":"2FAD9E78-AD6F-50D2-FA3B-628375B5C488"},
{"termName": "workQueue","operator":"=","termValue":"UG"},
);
query["taskSearchQuery"]=terms;
var jsonData = JSON.stringify(query);
_this.restClient.url(_this.$scope.URLS.TASK_LIST_COUNT_POST.url).requestData(jsonData).scope(_this.$scope).gadgetConfig(gadgetConfig)
.success(function(response,$scope){
_this.$scope.UGCount = response;
console.log("UG COUNT = " + _this.$scope.UGCount);
}).error(function(response,$scope){
_this.eventBus.fireEvent(NotificationConstants.ERROR,{"message":"Unable to invoke REST to " + _this.$scope.URLS.TASK_LIST_COUNT_POST.url,"source":_this.$scope.instance});
}).invoke();
};
The server type is set to the TE correctly calling the MWS but it always returns a 405 Method Not Allowed status.
The documentation is confusing so I’m not sure this is the correct way to set this up.
Any help appreciated