API
The Datafuse API provides access to various data services. In order to make use of our API you will first need the base url: https://api.datafuse.nl/
. Then you will need an API Key. If you don't have an API Key yet, you can find out here how to get one.
Once you have an API Key you can start using our API.
Usage
Below are Python and JavaScript examples using the requests
library in Python and the fetch
library in JavaScript to interact with the API. This example uses a Bearer token for authorization in both cases.
- Python
- Javascript
import requests
headers = {
"Authorization": "Bearer {API_KEY}",
"Content-Type": "application/json"
}
response = requests.get("https://api.datafuse.nl/...", headers=headers)
# Do stuf with the response...
var API_KEY = '{API_KEY}';
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer " + API_KEY);
myHeaders.append("Content-Type", "application/json");
var requestOptions = {
method: 'GET',
headers: myHeaders,
};
fetch("https://api.datafuse.nl/...", requestOptions)
.then(response => response.text())
.then(result => {
// Do stuff with the response...
console.log(result);
})
.catch(error => console.log('error', error));
tip
In the examples above, the term {API_KEY}
should be replaced with your actual API Key.