OpenSRP Web APIs
The below table shows and describes the APIs
BASEURL=BASEURL/opensrp/
Endpoint | Method | Description | Parameter | Sample |
---|---|---|---|---|
uniqueids/get | GET | This gets the unique identifiers that have can be assigned to patients on OpenMRS. The number of identifiers required can be variable | source: The ID of the OpenMRS Unique ID in the idgen module numberToGenerate: The total number of unique IDs you would like to generate | source=1&numberToGenerate=250 |
rest/clientForm/ | GET | This endpoint returns the client form matching the params | form_identifier: The form unique identifier eg. anc_registration.json form_version: The semantic version of the form eg. 0.0.2 strict: (Optional, default=false) Should the form_version of the form returned strictly match the param passed eg. true or false current_form_version: (Optional) The semantic version of the form that the client app currently holds and wants to upgrade from eg. 0.0.1 is_json_validator: (Optional, default=false) Is the requested form a JSON Widget validator form that defines fields that should always be present when a form is uploaded | form_identifier=anc_registration.json&form_version=0.0.2&strict=false¤t_form_version=0.0.1&is_json_validator=false |
rest/clientForm | POST | This enables publishing a new client form | form_identifier: (Optional) The form unique identifier eg. anc_registration_sub_form.json form_version: (Optional) The semantic version of the form eg. 0.0.2 form_relation: (Optional) This forms parent eg. anc_registration.json form_name: The label or display name for the form eg. ANC Registration Sub-Form form: The actual json form, properties file, or yaml file module: (Optional) The register that this form belongs to eg. OPD is_json_validator: (Optional, default=false) Is the upload form a JSON Widget validator form that defines fields that should always be present when a form is uploaded | |
rest/clientForm/metadata | GET | This endpoint returns a list of forms (just the metadata without the actual content ) | is_draft: (Optional) Defines the forms to be returned. Are they draft forms or published forms eg. true or false is_json_validator: (Optional) Boolean that defines whether the files to be returned | is_draft=false&is_json_validator=true |
rest/clientForm/release-related-files | GET | This endpoint returns the form metadata of all non-validator draft files that are on a manifest | identifier: The manifest identifier | identifier=1.2.45 |
rest/event/sync | GET | This gets all information from the openSRP server based on a team identifier in which the user belongs to. Limits allow for a specific number of records to be returned | serverVersion: This is a UNIX timestamp in miliseconds teamId: This is the UUID from the OpenMRS team from which you want to sync. You can access this Id in the OpenMRS UI Team Management Module limit: This is the total number of records you want to return. Keep this number low to improve server performance | serverVersion=1542961567681&teamId=6c8d2b9b-2246-47c2-949b-4fe29e888cc8&limit=250 |
rest/event/getAll | GET | This returns all events from a point in time | serverVersion: This is a UNIX timestamp in miliseconds (optional) eventType: This is an optional parameter that allows you to specify the type of events to return. (optional) limit: This is an optional parameter that limits the total number of responses you request. | serverVersion=1542961567681&eventType=Spray&limit=100 |
rest/client | POST | N/A | Sample Client{
"_id": "a0884952-595e-4c1f-b48a-2a4e5ef5812d",
"_rev": "v17",
"type": "Client",
"gender": "F",
"lastName": "Finaltri",
"middleName": "Maketri",
"addresses": [
],
"birthdate": "1990-01-01T03:00:00.000+03:00",
"firstName": "Dutatri ",
"attributes": {
"age": "19",
"edd": "2019-12-04",
"next_contact": "2",
"contact_status": "today",
"red_flag_count": "14",
"next_contact_date": "2019-07-17",
"yellow_flag_count": "9",
"last_contact_record_date": "2019-05-22"
},
"dateEdited": "2019-06-11T16:07:21.003+03:00",
"dateCreated": "2019-06-11T15:51:27.052+03:00",
"identifiers": {
"ANC_ID": "1021523-4"
},
"baseEntityId": "191cea0c-53e3-49ea-97c1-ec6d7cd5c3df",
"relationships": {},
"birthdateApprox": true,
"deathdateApprox": false,
"clientDatabaseVersion": 1,
"clientApplicationVersion": 1
} | |
rest/event/add | POST | N/A | Sample Event{
"_id": "2c93d750-2687-47f4-81bd-e3875544f397",
"obs": [
{
"values": [
"1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
],
"fieldCode": "1788AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"fieldType": "concept",
"parentCode": "",
"fieldDataType": "text",
"formSubmissionField": "referred_hosp",
"humanReadableValues": []
}
],
"_rev": "v2",
"team": "Bukesa",
"type": "Event",
"teamId": "6c8d2b9b-2246-47c2-949b-4fe29e888cc8",
"version": 1558530145433,
"duration": 0,
"eventDate": "2019-05-22T19:02:25.433+03:00",
"eventType": "Counselling and Treatment",
"dateEdited": "2019-05-22T16:07:56.566+03:00",
"entityType": "ec_woman",
"locationId": "44de66fb-e6c6-4bae-92bb-386dfe626eba",
"providerId": "demo",
"dateCreated": "2019-05-22T16:02:35.610+03:00",
"baseEntityId": "191cea0c-53e3-49ea-97c1-ec6d7cd5c3cf",
"serverVersion": 1558530155558,
"formSubmissionId": "f9154794-d3dc-483b-976c-088457af0448",
"clientDatabaseVersion": 1,
"clientApplicationVersion": 1
} | |
rest/location/sync | GET | This returns all locations in the system from the point in time defined in the serverVersion | is_jurisdiction: (optional) This returns locations that are tagged as jurisdictions in the system. serverVersion: This is a UNIX timestamp in miliseconds | is_jurisdiction=true&serverVersion=0 |
rest/location/{id} | GET | This returns the GeoJSON for a single location. Use the is_jurisdiction optional URL parameter if you want to return locations that have been tagged as jurisdictions. | is_jurisdiction: (optional) This returns locations that are tagged as jurisdictions in the system. | |
rest/location | POST | This endpoint supports the ability to POST locations to the system. | is_jurisdiction: (optional) This tags locations as jurisdictions in the system. | |
rest/location | PUT | This endpoint supports the ability to update existing locations in the system. | is_jurisdiction: (optional) This tags locations as jurisdictions in the system. | |
rest/manifest | GET | This endpoint returns a list of manifests from the first to the last chronologically. | ||
rest/manifest | POST | This endpoints enables posting a manifest. The manifest |
{
"identifier": "0.0.11",
"json": "{\"forms_version\":\"0.0.11\",\"identifiers\":[\"anc_quick_check.json\", \"respiratory_exam_sub_form.json\", \"rule/physical-exam-calculations-rules.yml\"]}",
"appId": "org.smartregister.anc",
"appVersion": "1.2.14"
} OR
| |
rest/manifest | PUT | This endpoints enables updating a manifest | ||
rest/manifest | DELETE | This endpoint enables deleting a manifest |
|
|
rest/manifest/{identifier} | GET | This endpoint returns the endpoint identified by identifier | ||
rest/manifest/add | POST | This endpoint enables posting a list of manifests. | ||
rest/manifest/appId/{app-id} | GET | This endpoint returns the latest manifest for an appId | rest/manifest/appId/org.smartregister.anc | |
rest/manifest/search | GET | This endpoint enables you to request a manifest for an specific app-version. | app_id: The app package name eg. org.smartregister.anc app_version: The app version code eg. 1.2.14 strict:(optional with default false) "true" OR "false". Defines whether the API should return a manifest that strictly matches the criteria | |
rest/plans/sync | GET | This returns all plans in the system from the point in time defined in the serverVersion. | serverVersion: This is a UNIX timestamp in miliseconds | serverVersion=0 |
rest/plans/{id} | GET | This returns a single plan. | N/A | |
rest/plans | POST | This endpoint supports the ability to POST new locations to the system. | ||
rest/task/sync | GET | This returns a list of tasks that are assigned to a plan and group combination since the time defined in the serverVersion | serverVersion: This is a UNIX timestamp in miliseconds plan: This is the ID of the plan group: This is the task group, which is defined as the location ID. | serverVersion=0&plan=356b6b84-fc36-4389-a44a-2b038ed2f38d&group=3952 |
rest/task | POST | This endpoint supports the ability to POST new tasks to the system | ||
rest/task | PUT | This endpoint supports the ability to update existing tasks in the system. | ||
rest/export | GET | This endpoint exports a CSV for a specific form submission. | formName: This is the name of the form that you wish to export | formName=child_enrollment |
/rest/formSubmission | GET | This supports submission of the various forms. | base_entity_id provider_id event_type formName | |
/rest/provider | GET | This endpoint supports authentication. | u: The username p: The password id: The team member ID from OpenMRS | u=demo&p=Amani123&id=d9e1bce3-56d3-4fb8-a194-0d3dbfe548e3 |
/rest/report/add | POST | This endpoint supports the ability to POST reports to the OpenSRP server. This is used for reporting to DHIS2. The body of the report is defined by each implementation | The body is defined by each implementation | |
/rest/search/path | GET | This endpoint supports the ability to search for clients in the system and was built for the ZEIR implementation's advanced search feature | zeir_id: This is the ZEIR ID to search for first_name: This is the first name of the client to search for middle_name: This is the middle name of the client to search for last_name: This is the last name of the client to search for birth_date: This is the date of birth of the client to search for in the YYYY-MM-DD format inactive: This is a true/false value for whether to search for clients who have been marked as inactive in the system lost_to_follow_up: This is a true/false value for whether to search for clients who have been marked as lost to follow-up in the system limit: This is the total number of records to return | |
/rest/settings/sync | GET | This gets all the settings for the team | teamId: This is the UUID from the OpenMRS team from which you want to sync. You can access this Id in the OpenMRS UI Team Management Module | |
/rest/settings/sync | POST | This updates the changes in settings | ||
/rest/stockresource/getAll | GET | This endpoint supports returning all stock items in the system | ||
/rest/stockresource/sync | GET | This endpoint supports returning all stock items since the time defined in the serverVersion ordered by serverVersion | serverVersion: This is a UNIX timestamp in miliseconds limit: This is the total number of records to return | serverVersion=0&limit=25 |
/rest/stockresource/add | POST | This endpoint supports adding stock items | ||
/rest/validate/sync | POST | This endpoint supports validating that the client and and event ids that are submitted reference actual documents | (Present a list of clients and a list of events) | |
/rest/viewconfiguration/sync | GET | This endpoint supports getting a list of Android client views (in the apps that support configurable views) | serverVersion: This is a UNIX timestamp in miliseconds | serverVersion=0 |
This site is no longer maintained. Please visit docs.opensrp.io for current documentation.