Skip to content

APMIS v1 API Documentation

Segun edited this page May 21, 2025 · 11 revisions

Introduction

APMIS (Afghanistan Polio Management Information System) is a supplemental immunization activities management system to manage the vaccination activities in the country.

APMIS API v1 is built from the ground up with a REST API that makes it easy for developers and sysadmins to automate access to campaign data through REST endpoints.

These docs describe how to use the APMIS API. We hope you enjoy these docs, and please don't hesitate to file an issue if you see anything missing.

Use Cases

There are many reasons to use the APMIS API. The most common use case is to gather report information for a given campaign, so that you can build custom reports in software you're most familiar with, such as Excel or Power Bi.

Authorization

To authenticate an API request, you should provide your APMIS REST USER username and password in the Authorization header. This can also be passed through a browser provided prompt at your first request call.

Please note that this is likely to leave traces in things like your history if accessing the API through a browser.

GET /sormas-rest/v1/campaigns
Parameter Type Description
username string Required. Your REST USER USERNAME
password string Required. Your REST USER PASSWORD

Responses

All API endpoints return the JSON representation of the resources requested. However, if an invalid request is submitted, or some other error occurs, APMIS returns a JSON response in the following format:

{
  "message" : string,
  "success" : bool,
  "data"    : string
}

The message attribute contains a message commonly used to indicate errors.

The success attribute describes if the transaction was successful or not.

The data attribute contains any other metadata associated with the response. This will be an escaped string containing JSON data.

Status Codes

APMIS returns the following status codes in its API:

Status Code Description
200 OK
400 BAD REQUEST
404 NOT FOUND
500 INTERNAL SERVER ERROR

Endpoints

The following endpoints are available in this version

Endpoint Parameter Description
/campaigns return a list of all active campaigns
/campaigns/{uuid} Campaign uuid Long return the campaign information a campaign
/campaigns/{uuid}/forms Campaign uuid Long return the campaign form metas of the campaign
/campaigns/{campaign_uuid}/forms/{form_uuid} Campaign uuid Long, Form uuid Long return all campaign form data of a form associated with the campaign

The /v1/campaigns is the starting point for all requests.

Fetching Geographical Units History

Overview

The Administrative Divisions History API provides access to the historical records of changes made to various geographical administrative units (provinces and districts). These endpoints track the chronological evolution of administrative divisions, capturing modifications such as name changes, status updates, and other administrative edits.

Endpoint Parameter Description
/areas/areaHistory This endpoint retrieves the complete modification history for all regions identified
/areas/areaHistory?getAreaHistory={uuid} Region UUID This endpoint retrieves the complete modification history for a specific regions identified
/regions/provincesHistory This endpoint retrieves the complete modification history for all provinces identified
/regions/provincesHistory?getProvinceHistory={uuid} Province UUID This endpoint retrieves the complete modification history for a specific province identified
/districts/districtsHistory This endpoint retrieves the complete modification history for all districts identified
/districts/districtsHistory?getDistrictHistory={uuid} District UUID This endpoint retrieves the complete modification history for a specific district identified
/communities/clustersHistory This endpoint retrieves the complete modification history for all clusters identified
/communities/clustersHistory?getClusterHistory={uuid} Cluster UUID This endpoint retrieves the complete modification history for a specific cluster identified

Form Versioning

Overview

The Campaign Forms Versions API provides access to the historical records of changes made to various campaign forms. These endpoints track the chronological evolution of campaign forms per edit/update, capturing modifications such as duplication and update.

Endpoint Parameter Description
/campaignFormMeta/getFormMetaHistory This endpoint retrieves the complete modification history for all campaign forms identified
/campaignFormMeta/getFormMetaHistory?getFormMetaHistoryByUuid={uuid} Campaign Form Meta UUID This endpoint retrieves the complete modification history for a specific campaign formm identified

Record Versioning

Overview

The Campaign Forms Data Record Versions API provides access to the historical records of changes made to various campaign data forms. These endpoints track the changes made to a campaign forms per edit/update, capturing modifications such as formvalues, and geographical unit changes, published and verified statuses e.t.c.

Endpoint Parameter Description
/apmisrestserver/formdatahistory?fetchFromIndex={index}&fetchSize={size} Index (Offset), Size(Maximum Result Size) This endpoint retrieves the complete modification history for all campaign forms identified within the maximum fetch size
/apmisrestserver/formdatahistory?fetchFromIndex={index}&fetchSize={size}&getRecordHistory={uuids} Index (Offset), Size(Maximum Result Size) , Uuids(Single record or Multiple record uuids(s) This endpoint retrieves the complete modification history for campaign form records as well as one or more identified records using their uuids
/apmisrestserver/formdatahistorycount?getRecordHistoryCount={uuid(s)} Uuids (uuid) Returns records counts for all records and returns the count of record when provided with the uuid query parameter. uuid are to be seperated by comma ","