我是Angular JS技术的新手。 我想调用以下受保护的REST URL。
http://localhost/rest/bpm/wle/v1/search/query?condition=taskActivityName|Equals|Cashier Review&condition=taskStatus|Equals|Received&organization=byTask&run=true&shared=false&filterByCurrentUser=false
以下代码对我不起作用。只需要http://localhost/rest/bpm/wle/v1/search/query。请建议。
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
var URLBASE = "http://localhost/rest/bpm/wle/v1";
var userid = "harish.puli";
var password = "Password1";
// End of buildAuthorization
var options =$.param ({
query : {
organization : "byTask",
condition : [ "taskActivityName|Equals|Cashier Review", "taskStatus|Equals|Received" ]
},
handleAs : "json",
user: "harish.puli",
password: "Password1"
});
var url=URLBASE+"/search/query";
$http.post(url,options).success(function (response) {
console.log(response);
$scope.tasks = response.data.data;
});
});
答案 0 :(得分:0)
我相信你错过了一个'?'在根据您提供的URL进行查询后。
尝试:
var url=URLBASE+"/search/query?";
答案 1 :(得分:0)
您的代码只调用http://localhost/rest/bpm/wle/v1/search/query,因为您使用的是post而不是get。让你在URL中传输参数,但在帖子中,它们在请求的主体中传输。