ok, I finally figured it out, I have to use 

headers:
    {
        'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
    } 


geeeeeeeeeeeeeezzzzzzzzzzzzz   

anyway..........


On Friday, 23 January 2015 12:20:03 UTC-6, Zhang Sowen wrote:
>
> Hi, I have tried many different ways, and this is just not working.
>
> I try to call Locu API 
>
>  var locuServiceUrl = "https://api.locu.com/v2/venue/search";;
>
>
>  var param = {
>  "api_key" : "My Key",
>  "venue_queries" : [{ "location" : {"locality": "My City"} } ]
>  };
>
>
>  $http({
>     url:locuServiceUrl, 
>     method: "POST",
>     data: param, 
>     headers: {'Content-Type': 'application/json'}
>  })
>  .success(function(data, status, headers, config) {
>  successCallback(data.objects);
>  finishLoading();
>  })
>
>
>
> the input is tested with Advanced Rest Client app and it works properly, 
> but I just can't get AngularJS work. 
>
> A side question: what is the difference between "params" and "data"? 
>
> If I use "params", I can get a response saying "request is not a valid 
> json data";
> If I use "data", I get a response saying "Method not allowed"; the service 
> only accepts POST
>
> I have tried to remove headers
> I also have tried different way to write the request, and based on my 
> understanding if I am not mistaken, I shouldn't have to., 
>
> I have spent more than 2 hours and I just can't get this work. 
>
> Locu has a deprecating API accepts GET, and that one works totally fine. 
> It's just this POST thing screwing me up. 
>
> Please help.
>
> thanks! 
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to