Reputation: 1645
I have the following API that I'm trying to connect to using AngularJS $http.get. However I can't build the correct URL.
This is the API URL I want to use
https://api.fda.gov/drug/event.json?search=receivedate:20040312
And this is the code I have
return $http.get('https://api.fda.gov/drug/event.json?search=', {
params: {
receivedate: val
}
But my results (Error) are the following
GET https://api.fda.gov/drug/event.json?search=&receivedate=20040312 400 (Bad Request)
Can someone help me structure this correctly? Thanks
Upvotes: 0
Views: 57
Reputation: 11198
the param is search
not receivedate
return $http.get('https://api.fda.gov/drug/event.json', {
params: {
search: 'receivedate:' + val
}
Upvotes: 2