eReport.generateToken to obtain an integration bearer token. OTP confirmation returns the X-EReport-View-Token required for listing or retrieving reports.12345import { createClient } from "egov.js"; const client = createClient({ baseUrl: "https://stg-ereport-ws.oueg.info", });
eReport.generateTokenPOST /api/integration/token exchanges the integration access code in the request body for a bearer token.1234567import { eReport } from "egov.js"; const integration = await eReport.generateToken({ client, body: { access_code: reportAccessCode }, throwOnError: true, });
eReport.listReportTypesGET /api/integration/datasets/report_types returns the report types available to an authenticated integration.1234567import { eReport } from "egov.js"; const reportTypes = await eReport.listReportTypes({ client, auth: integration.access_token, throwOnError: true, });
eReport.listRegionsGET /api/integration/datasets/regions returns the top-level administrative regions used by report forms.1234567import { eReport } from "egov.js"; const regions = await eReport.listRegions({ client, auth: integration.access_token, throwOnError: true, });
eReport.listProvincesGET /api/integration/datasets/provinces returns provinces for the required region code.12345678import { eReport } from "egov.js"; const provinces = await eReport.listProvinces({ client, auth: integration.access_token, query: { region_code: "040000000" }, throwOnError: true, });
eReport.listMunicipalitiesGET /api/integration/datasets/municipalities returns municipalities for the required province code.12345678import { eReport } from "egov.js"; const municipalities = await eReport.listMunicipalities({ client, auth: integration.access_token, query: { province_code: "042100000" }, throwOnError: true, });
eReport.listBarangaysGET /api/integration/datasets/barangays returns barangays for the required municipality code.12345678import { eReport } from "egov.js"; const barangays = await eReport.listBarangays({ client, auth: integration.access_token, query: { municipality_code: "042111000" }, throwOnError: true, });
eReport.submitComplaintPOST /api/integration/submit_complaint submits an authenticated citizen complaint and returns its case information.123456789101112131415161718192021import { eReport } from "egov.js"; const complaint = await eReport.submitComplaint({ client, auth: integration.access_token, body: { barangay_code: "042111001", complainant_email: "juan@example.gov.ph", first_name: "Juan", gender: "male", last_name: "Dela Cruz", message: "The streetlight has been out for three nights.", mobile: "+639171234567", municipality_code: "042111000", province_code: "042100000", region_code: "040000000", report_type: "infrastructure", subject: "Broken streetlight", }, throwOnError: true, });
eReport.requestOtpPOST /api/integration/verify/request dispatches the OTP used to authorize access to citizen report records.12345678import { eReport } from "egov.js"; const otpRequest = await eReport.requestOtp({ client, auth: integration.access_token, body: { email: "juan@example.gov.ph" }, throwOnError: true, });
eReport.confirmOtpPOST /api/integration/verify/confirm confirms an OTP and returns the report view token.1234567891011import { eReport } from "egov.js"; const confirmation = await eReport.confirmOtp({ client, auth: integration.access_token, body: { email: "juan@example.gov.ph", otp: submittedOtp, }, throwOnError: true, });
eReport.listReportsGET /api/integration/reports lists reports using X-EReport-View-Token, with optional search and pagination parameters.12345678import { eReport } from "egov.js"; const reports = await eReport.listReports({ client, headers: { "X-EReport-View-Token": confirmation.report_view_token }, query: { page: 1, limit: 10 }, throwOnError: true, });
eReport.getReportGET /api/integration/reports/{case_number} retrieves one report by case number using the report view token.12345678import { eReport } from "egov.js"; const report = await eReport.getReport({ client, headers: { "X-EReport-View-Token": confirmation.report_view_token }, path: { case_number: complaint.case_number }, throwOnError: true, });