Word Definition
The /v1/define/{word}
endpoint provides definitions for specific words.
Request
Endpoint
GET /v1/define/{word}
Parameters
The word to be defined is included directly in the URL path.
Example Request
GET /v1/define/dinosaur
Response
The response body will be a JSON object containing:
Parameter | Type | Description |
---|---|---|
status | Integer | The HTTP status code of the response. |
definitions | Array of Objects | An array containing different definitions of the word. |
Each definition object contains:
Parameter | Type | Description |
---|---|---|
partOfSpeech | String | The part of speech (noun, verb, etc.) |
definition | String | The meaning of the word |
examples | Array of Strings | Example uses of the word |
Example Response
{
"status": 200,
"definitions": [
{
"partOfSpeech": "noun",
"definition": "Any of various extinct reptiles of the orders Saurischia and Ornithischia that flourished during the Mesozoic Era.",
"examples": [
"The children were fascinated by the dinosaur exhibit at the museum.",
"Scientists discovered a new species of dinosaur in Argentina."
]
}
]
}
Code Examples
TypeScript
import axios from 'axios';
async function defineWord(word: string, token: string) {
const response = await axios.get(
`https://api.linguix.com/api/v1/define/${word}`,
{
headers: {
'Authorization': `Bearer ${token}`,
},
},
);
console.log(response.data);
}
defineWord('dinosaur', '<your-token>');
Python
import requests
import json
def define_word(word, token):
headers = {
'Authorization': f'Bearer {token}',
}
response = requests.get(f'https://api.linguix.com/api/v1/define/{word}', headers=headers)
print(json.dumps(response.json(), indent=4))
define_word('dinosaur', '<your-token>')
Java
import okhttp3.*;
public class Main {
public static void main(String[] args) throws Exception {
String word = "dinosaur";
String token = "<your-token>";
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.linguix.com/api/v1/define/" + word)
.get()
.addHeader("Authorization", "Bearer " + token)
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}