api

Katanga API Documentation

Document Revision History

Date Author Version Change Summary
03 Oct 2024 Think Zambia Dev 1.1 Created

Connection

API_URL: https://us-central1-natwange-east.cloudfunctions.net/api
x-api-key: Email dev@thinkzambia.org for the API key.

Endpoints

1. Validate Student

URL: {API\_URL}/katanga/v1/schools/:schoolId/students/:studentNumber/validate

TYPE: GET

PATH VARIABLES: schoolId: string studentNumber: string

HEADERS: x-api-key: string

SUCCESS:

{
  "schoolId": "string",
  "studentNumber": "string",
  "firstName": "string",
  "lastName": "string",
  "active": true
}

ERROR:

Returned when the student is not found.

{
  "status": "error",
  "message": "Student not found."
}

Returned when the school is not found.

{
  "status": "error",
  "message": "School not found."
}

Returned when the user is not authorized.

{
  "status": "error",
  "message": "Unauthorized."
}

SAMPLE RESPONSE:

{
  "status": "success",
  "data": {
    "schoolId": "thinkzambia",
    "studentNumber": "STU000001",
    "firstName": "Jelita",
    "lastName": "Mulenga",
    "active": true
  }
}

2. Student Payment

URL: {API\_URL}/katanga/v1/payments

TYPE: POST

HEADERS: x-api-key: string

BODY:

{
  "schoolId": "string",
  "studentNumber": "string",
  "paymentId": "string",
  "amount": 0,
  "madeBy": "string",
  "receivedBy": "string",
  "note": "string",
  "provider": "string",
  "status": "string",
}

SUCCESS:

{
  "status": "success",
  "data": {
    "paymentId": "string",
    "schoolId": "string",
    "studentNumber": "string",
    "amount": 0,
    "madeBy": "string",
    "note": "string",
    "provider": "string",
    "status": "string",
    "status": "string",
    "paymentDate": "string"
  }
}

ERROR:

Returned when the student is not found.

{
  "status": "error",
  "message": "Student not found."
}

Returned when the school is not found.

{
  "status": "error",
  "message": "School not found."
}

Returned when the user is not authorized.

{
  "status": "error",
  "message": "Unauthorized."
}