GraphQL API
In addition to our REST endpoints, Shobdo provides a GraphQL API for clients who want to minimize payload size and request exactly the fields they need.
POST /api/v1/api/graphqlSchema Overview
The GraphQL schema provides queries that mirror our REST capabilities:
search(q: String!, ...)autocomplete(q: String!, ...)examples(q: String!, ...)thesaurus(word: String!, ...)random(...)entry(id: String!, source: String!)wordEntry(word: String!, source: String!)
Example Request
cURL
curl -X POST "https://api.shobdo.me/api/v1/api/graphql" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "query": "query { search(q: \"hello\", limit: 2) { results { id word hasAudio } total } }" }'JavaScript
const response = await fetch("https://api.shobdo.me/api/v1/api/graphql", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
query: `query { search(q: "hello", limit: 2) { results { id word hasAudio } total } }`
})
});
const data = await response.json();Example Response
{
"data": {
"search": {
"results": [
{
"id": "1",
"word": "hello",
"hasAudio": true
},
{
"id": "2",
"word": "hello",
"hasAudio": false
}
],
"total": 12
}
}
}