Skip to content

Sample API

Mesonrale Ope edited this page Sep 25, 2023 · 12 revisions

Get Access Token

Create a free account at https://questions.aloc.com.ng On your dashboard, retrieve Access Token that will be attached to each API call.

A sample Access Token should look like this ALOC-78bfe77b49fb3e407bf8

A sample code

fetch('https://questions.aloc.com.ng/api/v2/q?subject=chemistry', {
  headers: {
    Accept: 'application/json',
    'Content-Type': 'application/json',
    AccessToken: 'ALOC-78bfe77b49fb3e407bf8',
  },
  method: 'GET',
})
  .then(response => response.json())
  .then(data => {
    console.log('data', data);
  })
  .catch(error => {
    console.log('error', error);
  });

Complete example

A full example

API Response sample

Get a question

https://questions.aloc.com.ng/api/v2/q?subject=chemistry

Sample response

Post APIs Doc

https://documenter.getpostman.com/view/1319216/2s9YCBuA3V

API call Examples

NOTE: Always add Access Token as shown above in each API call

https://questions.aloc.com.ng/api/v2/q?subject=chemistry

Get many questions (returns 40 by default)

https://questions.aloc.com.ng/api/v2/m?subject=chemistry

Get many questions (limit 120)

https://questions.aloc.com.ng/api/v2/m/100?subject=chemistry

Get several questions (limit 40)

https://questions.aloc.com.ng/api/v2/q/7?subject=chemistry

https://questions.aloc.com.ng/api/v2/q/25?subject=chemistry

Get a question by year

https://questions.aloc.com.ng/api/v2/q?subject=chemistry&year=2005

Get a question by exam type

https://questions.aloc.com.ng/api/v2/q?subject=chemistry&type=utme

Get a question by type and year

https://questions.aloc.com.ng/api/v2/q?subject=chemistry&year=2010&type=utme

Get question by id and subject

https://questions.aloc.com.ng/api/v2/q-by-id/1?subject=chemistry

For more detailed examples visit https://questions.aloc.com.ng

Clone this wiki locally