NECTA API
Published: 2022-02-20 21:29:46

Has it ever occurred to you that you want to fetch national examination results of Tanzania from an API and found nothing online, well that's history now.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9a9336tutj1bxj7a4if4.png)

I was faced with the same issue some time back in 2020 and so I set myself to the task of making it easier for others to fetch the results through an API, well at least after I had used it to solve the issue I wanted, which was creating a mobile app that could show these results in a simpler way and I called it [Tokeo Chapchap](http://tokeochapchap.herokuapp.com/) (you should definitely check it out) but, that’s a story for another time.

Today lets look at what powers that App, an incredible work of coding art, the [NECTA API](https://github.com/vincent-laizer/NECTA-API).

Its an open source tool written in python, by [Vincent Laizer](http://vincentsonlineresume.000webhostapp.com/), it can be found in [PyPI](https://pypi.org/project/nectaapi/) here. Its easy to use and well documented, you wont need anything more than the documentation to understand it.

At present it only works with ACSEE and CSEE exam results of 2015 to date, but it is under active development to give more services.
What can it do?

- Give a list of all schools in a given year and exam type (that is ACSEE or CSEE)
- Fetch specific student results, also given a year, exam type, school number and student number
- Get performance analysis of a school in a specific year and exam type
- Get analysis of a school performance over a range of year.
- Compare multiple schools performances' over a range of years. (This is only in its python package)

The API is split in two parts:

- REST API that you can send requests to, and freely get all that it has to offer .
- Python package, incase you need for python projects or even to host it on your own.

---

**REST API**

The NECTA REST API receives only GET request at the moment and all required data is passed in the URL and JSON is returned.
Some quick details
Base url:
    http://tokeochapchap.herokuapp.com/

- Get all schools in a give year:
    format: http://tokeochapchap.herokuapp.com/schools/[exam_year]/[csee|acsee]
example: http://tokeochapchap.herokuapp.com/schools/2021/csee

- Get student specific student results:
format: https://tokeochapchap.herokuapp.com/student/[exam_year]/[exam_type]/[school_number]/[student_number]
example: https://tokeochapchap.herokuapp.com/student/2021/csee/s4981/0013

- Get performance analysis of a school:
format: tokeochapchap.herokuapp.com/school/[exam_year]/[exam_type]/[school_number]
example: https://tokeochapchap.herokuapp.com/school/2020/acsee/s1268

- Get performance analysis over range of year for a school:
format: tokeochapchap.herokuapp.com/comparison/[start_year]/[end_year]/[exam_type]/[school_number]
example: https://tokeochapchap.herokuapp.com/comparison/2019/2020/csee/s1268

---

**Python Package**

The python package is well described in it documentation and the source code is well commented for readability, i need no more to explain it here. just check it out on github or pypi.
In the end it all comes to how we use the data, it is still governed by NECTA and the cyber crime laws of Tanzania. use it wisely.
Feedback on how to improve this project or the article are warmly welcome, thanks for sticking to the last letter, bye!