BabuJSON — Docs

No API keys — just call the endpoint and get JSON.

Quick Start

quick-start.js
fetch('/api/interview/react?limit=3')
  .then(res => res.json())
  .then(data => console.log(data));
Output
response.json
{
  "success": true,
  "category": "react",
  "totalAvailable": 80,
  "totalReturned": 3,
  "data": [
    { "id": "react_01", "question": "What is Virtual DOM?", "difficulty": "intermediate" },
    { "id": "react_02", "question": "What are React Hooks?", "difficulty": "beginner" },
    { "id": "react_03", "question": "Explain useEffect.", "difficulty": "intermediate" }
  ]
}

GET Requests

Fetch a single resource or list all resources.

get.js
// Single resource
fetch('/api/interview/react')
  .then(res => res.json())
  .then(data => console.log(data));

// All states
fetch('/api/india/states')
  .then(res => res.json())
  .then(data => console.log(data));
Output
response.json
{
  "success": true,
  "total": 36,
  "data": [
    { "code": "KA", "name": "Karnataka", "capital": "Bangalore" },
    { "code": "DL", "name": "Delhi", "capital": "New Delhi" },
    ...
  ]
}

Query Parameters

Filter with query params. Use limit and skip to paginate.

query-params.js
// Filter by difficulty
fetch('/api/interview/react?difficulty=advanced')

// Filter by type + paginate
fetch('/api/aptitude?type=logical&limit=5&skip=10')

// Cities in a state
fetch('/api/india/cities?stateCode=KA')

POST Requests

Send JSON in the body with Content-Type: application/json.

post.js
fetch('/api/resume-review', {
  method: 'POST',
  body: JSON.stringify({
    resumeText: 'John Doe - Software Engineer with 3 years of React experience...'
  }),
  headers: {
    'Content-type': 'application/json; charset=UTF-8',
  },
})
  .then(res => res.json())
  .then(data => console.log(data));
Output
response.json
{
  "success": true,
  "analysis": {
    "score": 78,
    "grade": "B+",
    "keyStrengths": ["Clear project descriptions"],
    "criticalGaps": ["Missing technical skills section"]
  }
}

Error Handling

Errors return { "success": false, "error": "..." } with an HTTP status code.

error-handling.js
fetch('/api/india/cities?stateCode=INVALID')
  .then(res => {
    if (!res.ok) {
      return res.json().then(err => { throw new Error(err.error); });
    }
    return res.json();
  })
  .then(data => console.log(data))
  .catch(err => console.error('API Error:', err.message));
// Output: API Error: State code 'INVALID' not found.