I need an apikey to be able to send a get request to a REST api. The request will look something like this -
$http.get( http://api.randomsite.com/page.json?api_key=apikey123 )
This will give me data in json format.
But i dont want the api key to appear in the url due to safety reasons. Is it possible to remove the api_key and somehow still make the get request work? Like this -
$http.get( http://api.randomsite.com/page.json )
I read its something to do with headers, but i tried a lot and cannot figure it out. Help :/
Well, if you want to hide the API_KEY, there's few ways to do this
POST
, although this is only a half measure, as anyone could look into the POST
body and see what it is. Nevertheless, the way you do it is by $http.post("api/salesapi.php/sales/", {API_KEY:xx}, {headers: ... });
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.