CBTHost

API Documentation

CBTHost API Documentation

Programmatically access exam results with our secure REST API endpoints

API Overview

The CBT Host API allows authorized users to retrieve exam results for individual students or entire exams. All API access requires authentication via specific headers.

Single Result Endpoint

GET https://cbthost.com/api/result

Retrieve a specific student's exam result using headers for authentication.

  • Returns detailed information about a single student
  • Uses headers for authentication (cbt-pass-code and test-id)
  • Returns JSON response with student details and scores

Mass Results Endpoint

GET https://cbthost.com/api/result/{cbt-pass-code}

Retrieve all student results for a specific exam identified by its passcode in the URL.

  • Returns all student results for an exam
  • Passcode is included directly in the URL path
  • Returns JSON response with student array and summary

Authentication

All API requests require authentication using specific headers. The authentication method differs between endpoints.

Header-Based Authentication

Include the following headers in your API requests:

Endpoint Header Description Example Required
Single Result cbt-pass-code Student's unique CBT pass code cbthost-pssi-0069 Required
Single Result test-id Identifier for the CBT test solomonpolycap3@gmail.com Required
Both Endpoints Accept Ensures JSON output application/json Required

Important: Missing or invalid credentials will return a 401 Unauthorized response. For the Mass Results API, the passcode is included directly in the URL path instead of headers.

Single Student Result

Retrieve a specific student's exam result using headers for authentication.

GET https://cbthost.com/api/result

Required Headers

Header Description Example Required
cbt-pass-code Student's unique CBT pass code cbthost-pssi-0069 Required
test-id Identifier for the CBT test solomonpolycap3@gmail.com Required
Accept Ensures JSON output application/json Required

Response Format

{
  "status": "success",
  "data": {
    "cbt_test_id": "solomonpolycap3@gmail.com",
    "cbt_test_info": "solomonpolycap3@gmail.com",
    "cbt_pass_code": "cbthost-pssi-0069",
    "cbt_total_score": 5
  }
}

Error Responses

400 Bad Request

{
  "serverstatus": 400,
  "message": "Missing required headers: cbt_pass_code, test_id"
}

404 Not Found

{
  "serverstatus": 404,
  "message": "cbt pass code is invalid, or no record found"
}

Mass Results

Retrieve all student results for a specific exam by including the passcode directly in the URL.

GET https://cbthost.com/api/result/{cbt-pass-code}

Required Headers

Header Description Example Required
Accept Ensures JSON output application/json Required

Response Format

{
  "status": "success",
  "data": [
    {
      "cbt_pass_code": "cbthost-pssi-0069",
      "cbt_test_id": "solomonpolycap3@gmail.com",
      "cbt_total_score": 5
    },
    {
      "cbt_pass_code": "cbthost-pssi-0070",
      "cbt_test_id": "solomonpolycap3@gmail.com",
      "cbt_total_score": 8
    }
  ]
}

Error Responses

404 Not Found

{
  "status": "error",
  "message": "No results found for this test ID"
}

API Examples

Implementation examples in popular programming languages and tools

JavaScript
Python
PHP
Java
cURL
Postman
// Single Result API using Fetch
const fetchSingleResult = async () => {
  const url = 'https://cbthost.com/api/result';
  
  const response = await fetch(url, {
    method: 'GET',
    headers: {
      'Accept': 'application/json',
      'cbt-pass-code': 'cbthost-pssi-0069',
      'test-id': 'solomonpolycap3@gmail.com'
    }
  });
  
  if (!response.ok) {
    throw new Error(`HTTP error! status: ${response.status}`);
  }
  
  const data = await response.json();
  console.log('Student Result:', data);
};

// Mass Results API using Fetch
const fetchMassResults = async () => {
  const passcode = 'cbthost-pssi-0069';
  const url = `https://cbthost.com/api/result/${passcode}`;
  
  const response = await fetch(url, {
    method: 'GET',
    headers: {
      'Accept': 'application/json'
    }
  });
  
  if (!response.ok) {
    throw new Error(`HTTP error! status: ${response.status}`);
  }
  
  const data = await response.json();
  console.log('Mass Results:', data);
};

// Call the functions
fetchSingleResult();
fetchMassResults();

Developer Resources

Tools and resources to help you integrate with our API

GitHub Repository

Download plugins and SDKs for both online and offline software

View on GitHub

Video Tutorials

Watch step-by-step integration guides

Watch Tutorials

API Testing Tool

Test API endpoints directly in your browser

Try API Tester

Need Help?

Our support team is ready to assist you with API integration

Email Support

Get personalized assistance via email

Contact Us

WhatsApp

Quick responses via WhatsApp

Message Us

Technical Support

Submit a ticket for personalized assistance

Submit Ticket

Still Have Questions?

If you don't understand any part of the documentation or need clarification on implementation, don't hesitate to reach out directly.