0

I wanted to send the request body as the JSON object to RESTful service

REST API Call:

GET http://localhost/api/v1/logsearch/query
{'query': {'match_all': {}}}

Here is my DS.defineResource

return DS.defineResource({
      basePath: '/api/v1',
      endpoint: '/logsearch/query',
      cacheResponse: false,
      maxAge: 0, // cache expires immediately
      name: 'log',
      idAttribute: '_id',

Any example that I can send the JSON object to GET Request RESTful API call using JS Data

The JSON Object that I wanted to send is : {'query': {'match_all': {}}}

Thanks for your help

Kim
  • 185
  • 2
  • 4
  • 12

1 Answers1

0

to post to an object in angular to an 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
}) 
Tik
  • 792
  • 5
  • 14