我想将请求主体作为JSON对象发送到RESTful服务
REST API调用:
GET http://localhost/api/v1/logsearch/query
{'query': {'match_all': {}}}
这是我的DS.defineResource
return DS.defineResource({
basePath: '/api/v1',
endpoint: '/logsearch/query',
cacheResponse: false,
maxAge: 0, // cache expires immediately
name: 'log',
idAttribute: '_id',
我可以使用JS Data
将JSON对象发送到GET Request RESTful API调用的任何示例我想发送的JSON对象是: {'query':{'match_all':{}}}
感谢您的帮助
答案 0 :(得分:0)
以角度发布到api的对象。
var obj = {'query': {'match_all': {}}};
$http.post('http://localhost/api/v1/logsearch/query', obj)
.then(function(data){//where data is the result returned by your api
//do something with data returned here
}, function(errors){
//handle any errors here
})