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());
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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());
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
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"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.