If you want to customize the parameter serializer, you can do so in the following way:
axios.get('https://foobar.com/api', {
paramsSerializer: function(params) {
var result = '';
// Create the query string
return result;
}
});
You have the option of setting the paramsSerializer
at either the instance level:
var instance = axios.create({ paramsSerializer: function(params) { /* ... */ } })
or at the global level:
axios.defaults.paramsSerializer = function(params) { /* ... */ };
Another approach is to simply include the API key directly in the URL:
axios.get('https://foobar.com/api?api_key=' + key);
To add extra parameters, you can utilize the `params' configuration option:
axios.get('https://foobar.com/api?api_key=' + key, {
params: {
foo: 'bar'
}
});