@sdashapis/sdk
v1.0.0
Published
Official SDK for SdashAPI - Access Nigerian past exam questions (UTME, WAEC, NECO, Post-UTME).
Maintainers
Readme
@sdashapis/sdk
Official Node.js and TypeScript SDK for SdashAPI. Give your developers instant access to thousands of past exam questions for UTME, WAEC, NECO and Post-UTME — with answers, solutions, and a simple REST API.
Installation
npm install @sdashapis/sdk
# or
yarn add @sdashapis/sdk
# or
pnpm add @sdashapis/sdkQuick Start
import { SdashAPI } from '@sdashapis/sdk';
// 1. Initialize the client
const api = new SdashAPI({
apiKey: 'YOUR_ACCESS_TOKEN', // Get your token from sdashapi.com/dashboard
});
async function main() {
try {
// 2. Fetch a random chemistry UTME question from 2022
const question = await api.getQuestions({
subject: 'chemistry',
type: 'utme',
year: 2022
});
console.log(question);
/*
Output:
{
id: 4821,
question: "Which of the following is the chemical formula for table salt?",
option: { a: "NaCl", b: "KCl", c: "CaCO3", d: "NaOH" },
answer: "a",
...
}
*/
// 3. Fetch 10 random questions
const questionsList = await api.getQuestions({ limit: 10 });
console.log(`Fetched ${Array.isArray(questionsList) ? questionsList.length : 1} questions`);
} catch (error) {
console.error("Failed to fetch questions:", error.message);
}
}
main();Endpoints Supported
getQuestions(params): Fetch past questions with filters.getSubjects(): List available subjects (Biology, Chemistry, etc.).getExams(): List supported exams (UTME, WAEC, NECO, etc.).getYears(): List available years.reportQuestion(params): Report issues with questions (typos, wrong answers).
Error Handling
The SDK throws a SdashAPIError if the API request fails (e.g., invalid token, rate limits). You can catch this error and check the status code.
License
MIT
