- fetch()
- Last updated on
Query Parameters
Some APIs accept a token or other credentials as a query string parameter on the endpoint URL.
// Make the API call
fetch('https://my-app.com/wizards?token=1234').then(function (response) {
if (response.ok) {
return response.json();
}
throw response;
}).then(function (data) {
render(data);
}).catch(function (error) {
console.log(error);
});