MENU navbar-image

Introduction

This documentation aims to provide all the information you need to work with our API.

Authenticating requests

This API is not authenticated.

Authentication

Login.

Example request:
curl --request POST \
    "http://localhost/api/login" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"phone_number\": \"v\",
    \"password\": \"G>?m8u*m(j}#\'+c\"
}"
const url = new URL(
    "http://localhost/api/login"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "phone_number": "v",
    "password": "G>?m8u*m(j}#'+c"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

POST api/login

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

phone_number   string   

Must start with one of 256 Must not be greater than 225 characters. Example: v

password   string   

Example: G>?m8u*m(j}#'+c

Get User Account

requires authentication

Retrieve the currently logged in user details.

Example request:
curl --request GET \
    --get "http://localhost/api/profile" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://localhost/api/profile"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/profile

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Logout

requires authentication

Logout the current user .

Example request:
curl --request POST \
    "http://localhost/api/logout" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://localhost/api/logout"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Request      

POST api/logout

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Profile Management

APIs for Profile management

Farmer Group

Farmer group api profiling

Add new farmer group

requires authentication

Endpoint to add farmer groups

Example request:
curl --request POST \
    "http://localhost/api/add-farmer-group" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"farmer_group\": \"kjfsnutbuycwkpscrkxykuin\",
    \"establishment_year\": \"cumque\",
    \"group_bank_account\": \"No\",
    \"email_address\": \"fjakubowski@example.com\",
    \"new_group\": \"Old\",
    \"participation_of_collective_marketing\": \"No\",
    \"is_member_of_dairy_cooperative\": \"No\",
    \"have_a_market_map\": \"No\",
    \"received_mastercard_support\": \"Yes\",
    \"have_a_storage_facility\": \"No\",
    \"received_other_ngo_support\": \"No\",
    \"have_modern_dairy_equipment\": \"No\",
    \"type_of_dairy_equipment_ownership\": \"Rented\",
    \"have_constitution_or_law\": \"Yes\",
    \"is_group_involved_in_selling_related_dairy_products\": \"Yes\",
    \"does_group_keep_records\": \"No\",
    \"involved_in_vsla_services\": \"No\",
    \"have_a_business_plan\": \"No\",
    \"enterprise_id\": \"sit\",
    \"loan_received_in_last_year\": \"Yes\",
    \"registration_status\": \"In_progress\",
    \"group_representative_first_name\": \"aeryffatvtpe\",
    \"group_representative_last_name\": \"qumbrlyzehxqvtsvm\",
    \"group_representative_contact\": \"256jdkm\",
    \"group_position_id\": \"vitae\",
    \"group_representative_mobile_money\": \"No\",
    \"village_id\": \"rerum\",
    \"user_id\": \"aut\"
}"
const url = new URL(
    "http://localhost/api/add-farmer-group"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "farmer_group": "kjfsnutbuycwkpscrkxykuin",
    "establishment_year": "cumque",
    "group_bank_account": "No",
    "email_address": "fjakubowski@example.com",
    "new_group": "Old",
    "participation_of_collective_marketing": "No",
    "is_member_of_dairy_cooperative": "No",
    "have_a_market_map": "No",
    "received_mastercard_support": "Yes",
    "have_a_storage_facility": "No",
    "received_other_ngo_support": "No",
    "have_modern_dairy_equipment": "No",
    "type_of_dairy_equipment_ownership": "Rented",
    "have_constitution_or_law": "Yes",
    "is_group_involved_in_selling_related_dairy_products": "Yes",
    "does_group_keep_records": "No",
    "involved_in_vsla_services": "No",
    "have_a_business_plan": "No",
    "enterprise_id": "sit",
    "loan_received_in_last_year": "Yes",
    "registration_status": "In_progress",
    "group_representative_first_name": "aeryffatvtpe",
    "group_representative_last_name": "qumbrlyzehxqvtsvm",
    "group_representative_contact": "256jdkm",
    "group_position_id": "vitae",
    "group_representative_mobile_money": "No",
    "village_id": "rerum",
    "user_id": "aut"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "farmer_group_code": null,
        "farmer_group": null,
        "establishment_year": null,
        "group_bank_account": null,
        "new_group": null,
        "participation_of_collective_marketing": null,
        "is_member_of_dairy_cooperative": null,
        "have_a_market_map": null,
        "have_a_storage_facility": null,
        "received_other_ngo_support": null,
        "have_modern_dairy_equipment": null,
        "have_constitution_or_law": null,
        "is_group_involved_in_selling_related_dairy_products": null,
        "does_group_keep_records": null,
        "involved_in_vsla_services": null,
        "have_a_business_plan": null,
        "loan_received_in_last_year": null,
        "registration_status": null,
        "group_representative_first_name": null,
        "group_representative_last_name": null,
        "group_representative_contact": null,
        "group_representative_mobile_money": null
    }
}
 

Request      

POST api/add-farmer-group

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

farmer_group   string   

Must not be greater than 225 characters. Example: kjfsnutbuycwkpscrkxykuin

establishment_year   string   

Example: cumque

group_bank_account   string   

Must be one of Yes or No. Example: No

email_address   string  optional  

Must be a valid email address. Example: fjakubowski@example.com

financial_institution_id   string  optional  

This field is required when group_bank_account is Yes.

account_number   string  optional  

This field is required when group_bank_account is Yes.

account_name   string  optional  

This field is required when group_bank_account is Yes.

new_group   string   

Must be one of New or Old. Example: Old

participation_of_collective_marketing   string   

Must be one of Yes or No. Example: No

is_member_of_dairy_cooperative   string   

Must be one of Yes or No. Example: No

cooperative_id   string  optional  

This field is required when is_member_of_dairy_cooperative is Yes.

have_a_market_map   string   

Must be one of Yes or No. Example: No

last_updated_market_map   string  optional  

This field is required when have_a_market_map is Yes.

received_mastercard_support   string   

Must be one of Yes or No. Example: Yes

mastercard_program_id   string  optional  

This field is required when received_mastercard_support is 1.

have_a_storage_facility   string   

Must be one of Yes or No. Example: No

received_other_ngo_support   string   

Must be one of Yes or No. Example: No

have_modern_dairy_equipment   string   

Must be one of Yes or No. Example: No

type_of_dairy_equipment_ownership   string  optional  

This field is required when have_modern_dairy_equipment is Yes. Must be one of Owned or Rented. Example: Rented

have_constitution_or_law   string   

Must be one of Yes or No. Example: Yes

is_group_involved_in_selling_related_dairy_products   string   

Must be one of Yes or No. Example: Yes

does_group_keep_records   string   

Must be one of Yes or No. Example: No

records_description   string  optional  

This field is required when does_group_keep_records is Yes.

involved_in_vsla_services   string   

Must be one of Yes or No. Example: No

vsla_services_description   string  optional  

This field is required when involved_in_vsla_services is Yes.

have_a_business_plan   string   

Must be one of Yes or No. Example: No

last_updated_business_plan   string  optional  

This field is required when have_a_business_plan is Yes.

enterprise_id   string   

Example: sit

loan_received_in_last_year   string   

Must be one of Yes or No. Example: Yes

loan_financial_institution_id   string  optional  

This field is required when loan_received_in_last_year is Yes.

registration_status   string   

Must be one of Registered, In_progress, or Not_registered. Example: In_progress

registration_number   string  optional  

This field is required when registration_status is Registered.

group_representative_first_name   string   

Must not be greater than 225 characters. Example: aeryffatvtpe

group_representative_last_name   string   

Must not be greater than 225 characters. Example: qumbrlyzehxqvtsvm

group_representative_contact   string   

Must start with one of 256. Example: 256jdkm

group_position_id   string   

Example: vitae

group_representative_mobile_money   string   

Must be one of Yes or No. Example: No

village_id   string   

Example: rerum

user_id   string   

Example: aut

Get farmer groups by Code

requires authentication

Endpoint to get farmer groups

Example request:
curl --request GET \
    --get "http://localhost/api/farmer-groups/sit" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://localhost/api/farmer-groups/sit"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "data": {
        "farmer_group_code": null,
        "farmer_group": null,
        "establishment_year": null,
        "group_bank_account": null,
        "new_group": null,
        "participation_of_collective_marketing": null,
        "is_member_of_dairy_cooperative": null,
        "have_a_market_map": null,
        "have_a_storage_facility": null,
        "received_other_ngo_support": null,
        "have_modern_dairy_equipment": null,
        "have_constitution_or_law": null,
        "is_group_involved_in_selling_related_dairy_products": null,
        "does_group_keep_records": null,
        "involved_in_vsla_services": null,
        "have_a_business_plan": null,
        "loan_received_in_last_year": null,
        "registration_status": null,
        "group_representative_first_name": null,
        "group_representative_last_name": null,
        "group_representative_contact": null,
        "group_representative_mobile_money": null
    }
}
 

Example response (401, User does not have rights to carry out this action):


{
    "message": "Unauthorised to perform this action"
}
 

Example response (404, Farmer group not found):


{
    "message": "Requested farmer group not found"
}
 

Request      

GET api/farmer-groups/{farmer_group_code}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

farmer_group_code   string   

The farmer group code of the farmer group. Example: sit

Get farmer groups

requires authentication

Endpoint to get farmer groups

Example request:
curl --request GET \
    --get "http://localhost/api/farmer-groups" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://localhost/api/farmer-groups"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "data": [
        {
            "farmer_group_code": null,
            "farmer_group": null,
            "establishment_year": null,
            "group_bank_account": null,
            "new_group": null,
            "participation_of_collective_marketing": null,
            "is_member_of_dairy_cooperative": null,
            "have_a_market_map": null,
            "have_a_storage_facility": null,
            "received_other_ngo_support": null,
            "have_modern_dairy_equipment": null,
            "have_constitution_or_law": null,
            "is_group_involved_in_selling_related_dairy_products": null,
            "does_group_keep_records": null,
            "involved_in_vsla_services": null,
            "have_a_business_plan": null,
            "loan_received_in_last_year": null,
            "registration_status": null,
            "group_representative_first_name": null,
            "group_representative_last_name": null,
            "group_representative_contact": null,
            "group_representative_mobile_money": null
        },
        {
            "farmer_group_code": null,
            "farmer_group": null,
            "establishment_year": null,
            "group_bank_account": null,
            "new_group": null,
            "participation_of_collective_marketing": null,
            "is_member_of_dairy_cooperative": null,
            "have_a_market_map": null,
            "have_a_storage_facility": null,
            "received_other_ngo_support": null,
            "have_modern_dairy_equipment": null,
            "have_constitution_or_law": null,
            "is_group_involved_in_selling_related_dairy_products": null,
            "does_group_keep_records": null,
            "involved_in_vsla_services": null,
            "have_a_business_plan": null,
            "loan_received_in_last_year": null,
            "registration_status": null,
            "group_representative_first_name": null,
            "group_representative_last_name": null,
            "group_representative_contact": null,
            "group_representative_mobile_money": null
        }
    ]
}
 

Example response (401, User does not have rights to carry out this action):


{
    "message": "Unauthorised to perform this action"
}
 

Request      

GET api/farmer-groups

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Participant

Participant api profiling

Add new participant

requires authentication

Endpoint to add participant

Example request:
curl --request POST \
    "http://localhost/api/add-participant" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"farmer_group_id\": \"omnis\",
    \"last_name\": \"dhqdoadpdkquarcsahcj\",
    \"first_name\": \"mruqitpgrbzpdgfftb\",
    \"other_name\": \"khj\",
    \"new_participant\": \"1\",
    \"is_house_hold_head\": \"0\",
    \"participant_type_id\": \"quas\",
    \"household_head_first_name\": \"sggnhfeqzieunfbcxpfixezxl\",
    \"household_head_last_name\": \"dtbrcdghvoghojka\",
    \"household_size\": 16,
    \"group_position_id\": \"maxime\",
    \"participant_mobile_money\": \"0\",
    \"registered_mobile_money\": \"0\",
    \"participant_bank_account\": \"0\",
    \"account_number\": \"et\",
    \"enterprise_id\": \"ipsam\",
    \"is_participant_involved_in_selling_related_dairy_products\": \"0\",
    \"received_other_ngo_support\": \"1\",
    \"received_loan_in_last_year\": \"0\",
    \"dairy_skill_id\": \"aut\",
    \"village_id\": \"dolorem\",
    \"participant_contact\": \"256isle\",
    \"gender\": \"Male\",
    \"number_of_pwd_in_house_hold\": \"qui\",
    \"year_of_birth\": \"ttcf\",
    \"min_income_range\": 7,
    \"max_income_range\": 7,
    \"created_by\": \"accusantium\",
    \"gps_latitude\": \"aspernatur\",
    \"gps_longitude\": \"error\",
    \"pwd_status\": \"1\",
    \"refugee_status\": \"1\",
    \"received_mastercard_support\": \"1\"
}"
const url = new URL(
    "http://localhost/api/add-participant"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "farmer_group_id": "omnis",
    "last_name": "dhqdoadpdkquarcsahcj",
    "first_name": "mruqitpgrbzpdgfftb",
    "other_name": "khj",
    "new_participant": "1",
    "is_house_hold_head": "0",
    "participant_type_id": "quas",
    "household_head_first_name": "sggnhfeqzieunfbcxpfixezxl",
    "household_head_last_name": "dtbrcdghvoghojka",
    "household_size": 16,
    "group_position_id": "maxime",
    "participant_mobile_money": "0",
    "registered_mobile_money": "0",
    "participant_bank_account": "0",
    "account_number": "et",
    "enterprise_id": "ipsam",
    "is_participant_involved_in_selling_related_dairy_products": "0",
    "received_other_ngo_support": "1",
    "received_loan_in_last_year": "0",
    "dairy_skill_id": "aut",
    "village_id": "dolorem",
    "participant_contact": "256isle",
    "gender": "Male",
    "number_of_pwd_in_house_hold": "qui",
    "year_of_birth": "ttcf",
    "min_income_range": 7,
    "max_income_range": 7,
    "created_by": "accusantium",
    "gps_latitude": "aspernatur",
    "gps_longitude": "error",
    "pwd_status": "1",
    "refugee_status": "1",
    "received_mastercard_support": "1"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "first_name": null,
        "last_name": null,
        "other_name": null
    }
}
 

Request      

POST api/add-participant

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

farmer_group_id   string   

Example: omnis

last_name   string   

Must not be greater than 225 characters. Example: dhqdoadpdkquarcsahcj

first_name   string   

Must not be greater than 225 characters. Example: mruqitpgrbzpdgfftb

other_name   string  optional  

Must not be greater than 225 characters. Example: khj

new_participant   string   

Must be one of 1 or 0. Example: 1

is_house_hold_head   string   

Must be one of 1 or 0. Example: 0

participant_type_id   string   

Example: quas

household_head_first_name   string  optional  

This field is required when is_house_hold_head is 0. Must not be greater than 225 characters. Example: sggnhfeqzieunfbcxpfixezxl

household_head_last_name   string  optional  

This field is required when is_house_hold_head is 0. Must not be greater than 225 characters. Example: dtbrcdghvoghojka

household_size   integer   

Example: 16

group_position_id   string   

Example: maxime

participant_mobile_money   string   

Must be one of 1 or 0. Example: 0

registered_mobile_money   string   

Must be one of 1 or 0. Example: 0

other_names_registered   string  optional  

This field is required when registered_mobile_money is 0.

own_a_smart_phone   string  optional  

This field is required when participant_type_id is 22.

employment_status   string  optional  

This field is required when participant_type_id is .

community_role_id   string  optional  

This field is required when participant_type_id is 2.

participant_bank_account   string   

Must be one of 1 or 0. Example: 0

financial_institution_id   string  optional  

This field is required when participant_bank_account is 1.

account_number   string  optional  

This field is required when participant_bank_account is 1. Example: et

enterprise_id   string   

Example: ipsam

is_participant_involved_in_selling_related_dairy_products   string   

Must be one of 1 or 0. Example: 0

received_other_ngo_support   string   

Must be one of 1 or 0. Example: 1

received_loan_in_last_year   string   

Must be one of 1 or 0. Example: 0

loan_financial_institution_id   string  optional  

This field is required when received_loan_in_last_year is 1.

dairy_skill_id   string   

Example: aut

village_id   string   

Example: dolorem

participant_contact   string   

Must start with one of 256. Example: 256isle

gender   string   

Must be one of Male or Female. Example: Male

number_of_pwd_in_house_hold   string   

Example: qui

year_of_birth   string   

Must be 4 characters. Example: ttcf

min_income_range   integer   

Example: 7

max_income_range   integer   

Example: 7

created_by   string   

Example: accusantium

gps_latitude   string   

Example: aspernatur

gps_longitude   string   

Example: error

pwd_status   string   

Must be one of 1 or 0. Example: 1

refugee_status   string   

Must be one of 1 or 0. Example: 1

received_mastercard_support   string   

Must be one of 1 or 0. Example: 1

mastercard_program_id   string  optional  

This field is required when received_mastercard_support is 1.

GET api/participants

requires authentication

Example request:
curl --request GET \
    --get "http://localhost/api/participants" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://localhost/api/participants"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/participants

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Reference Information

APIs for refrence data

Get financial Institutions

requires authentication

Endpoint to get financial institutions

Example request:
curl --request GET \
    --get "http://localhost/api/financial-institutions" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://localhost/api/financial-institutions"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "data": [
        {
            "id": 1,
            "financial_institution": "Stanbic Bank",
            "category": "bank"
        },
        {
            "id": 1,
            "financial_institution": "Stanbic Bank",
            "category": "bank"
        }
    ]
}
 

Example response (401, User does not have rights to carry out this action):


{
    "message": "Unauthorised to perform this action"
}
 

Request      

GET api/financial-institutions

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Get Enterprises

requires authentication

Endpoint to get enterprises

Example request:
curl --request GET \
    --get "http://localhost/api/enterprises" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://localhost/api/enterprises"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "data": [
        {
            "id": null,
            "enterprise": null
        },
        {
            "id": null,
            "enterprise": null
        }
    ]
}
 

Example response (401, User does not have rights to carry out this action):


{
    "message": "Unauthorised to perform this action"
}
 

Request      

GET api/enterprises

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Get Co operatives

requires authentication

Endpoint to get Co operatives

Example request:
curl --request GET \
    --get "http://localhost/api/cooperatives" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://localhost/api/cooperatives"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "data": [
        {
            "id": null,
            "cooperative": null
        },
        {
            "id": null,
            "cooperative": null
        }
    ]
}
 

Example response (401, User does not have rights to carry out this action):


{
    "message": "Unauthorised to perform this action"
}
 

Request      

GET api/cooperatives

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Get Group Position

requires authentication

Endpoint to get group positions

Example request:
curl --request GET \
    --get "http://localhost/api/group-positions" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://localhost/api/group-positions"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "data": [
        {
            "id": 1,
            "group_position": "Chair person"
        },
        {
            "id": 1,
            "group_position": "Chair person"
        }
    ]
}
 

Example response (401, User does not have rights to carry out this action):


{
    "message": "Unauthorised to perform this action"
}
 

Request      

GET api/group-positions

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Get MasterCard Programs

requires authentication

Endpoint to get master card programs

Example request:
curl --request GET \
    --get "http://localhost/api/mastercard-programs" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://localhost/api/mastercard-programs"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "data": [
        {
            "id": null,
            "mastercard_program": null
        },
        {
            "id": null,
            "mastercard_program": null
        }
    ]
}
 

Example response (401, User does not have rights to carry out this action):


{
    "message": "Unauthorised to perform this action"
}
 

Request      

GET api/mastercard-programs

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Get Districts

requires authentication

Endpoint to get districts

Example request:
curl --request GET \
    --get "http://localhost/api/districts" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://localhost/api/districts"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "data": [
        {
            "id": 1,
            "district": "Sheema"
        },
        {
            "id": 1,
            "district": "Sheema"
        }
    ]
}
 

Example response (401, User does not have rights to carry out this action):


{
    "message": "Unauthorised to perform this action"
}
 

Request      

GET api/districts

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Get Sub counties

requires authentication

Endpoint to get sub counties

Example request:
curl --request GET \
    --get "http://localhost/api/subcounties" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://localhost/api/subcounties"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "data": [
        {
            "id": 1,
            "district_id": 1,
            "subcounty": "KAHINDO"
        },
        {
            "id": 1,
            "district_id": 1,
            "subcounty": "KAHINDO"
        }
    ]
}
 

Example response (401, User does not have rights to carry out this action):


{
    "message": "Unauthorised to perform this action"
}
 

Request      

GET api/subcounties

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Get Parishes

requires authentication

Endpoint to get parishes

Example request:
curl --request GET \
    --get "http://localhost/api/parishes" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://localhost/api/parishes"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "data": [
        {
            "id": 1,
            "subcounty_id": 1,
            "parish": "RWEIBARE"
        },
        {
            "id": 1,
            "subcounty_id": 1,
            "parish": "RWEIBARE"
        }
    ]
}
 

Example response (401, User does not have rights to carry out this action):


{
    "message": "Unauthorised to perform this action"
}
 

Request      

GET api/parishes

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Get Parishes

requires authentication

Endpoint to get villages

Example request:
curl --request GET \
    --get "http://localhost/api/villages" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://localhost/api/villages"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "data": [
        {
            "id": 1,
            "village": "KYAMUTIGANZI A",
            "parish_id": 1
        },
        {
            "id": 1,
            "village": "KYAMUTIGANZI A",
            "parish_id": 1
        }
    ]
}
 

Example response (401, User does not have rights to carry out this action):


{
    "message": "Unauthorised to perform this action"
}
 

Request      

GET api/villages

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json