Organisation Units
Organisationunit object includes the following keys.#
| Key | Description | Required | Type |
|---|---|---|---|
| id | Unique identifier(Autogenerated) | Autogenerated | Number |
| uid | 13 varying characters used for CRUD operations | NO | String(UID) |
| code | Unique value that can also be used for CRUD operations | YES | String |
| name | Defines the name of a particular entity | YES | String |
| shortName | OrganisationUnits short name | YES | String |
| description | Overview of the entity and all related details | NO | Text |
| active | Organisationunit's current operation status | NO | Boolean |
| parent | Organisationunit's parent of any | NO | String |
| created | Organisationunit's date of creation | NO | Date |
| lastupdated | Organisationunit's date for when it was last updated | NO | Date |
| publicAccess | If the Organisationunit has public access within the system | NO | Boolean |
| externalAccess | If the Organisationunit has external access outside the system | NO | Boolean |
| closingDate | The closing date of the Organisationunit if it was closed | NO | Date |
| openingDate | opening date of the Organisationunit | NO | Date |
| geoCode | Geo location code of the Organisationunit | NO | GeoJson |
| coordinates | Organisationunit coordinates | NO | Array |
| featureType | The type of the Organisationunit's feature coordinate | NO | String |
| address | Organisationunit's address | NO | String |
| contactPerson | Organisationunit's contact person if any. | NO | String |
| phoneNumber | Contact person's phone number | NO | Number |
| Contact person's address | NO | String |
Adding OrganisationUnits#
New Organisationunits in the system can be added to the list of organisationunits.
NOTE:All Organisationunits containt a uniquecode
Endpoint
Payload
Response On Success
A unique identifiable can be explicitly defined as
idif there is a need of keeping memory of it otherwise the system will create one automatically. Unique identifiers are varying characters with strictly 13 characters of length.IDs can be generated from the system as follows
Endpoint
- This generates one ID
- This generates a list of 4 IDs.
> Limit can be defined for a desired number of IDS
Response
Adding organisationUnit with specified ID#
Payload
Response
Adding child OrganisationUnits#
A child organisationUnit can be added to a list contain a parent to that child.
- These can be added by including the
parent IDorparent code
Adding with parent ID#
Endpoint
Payload
Reponse
Adding with parent CODE#
Endpoint
Payload
Reponse
Response On Failure
- When posting fails, responses will differ depending on what caused the failure as follows:-
- Failure due to duplicates on unique organisationUnit properties
Response
- Missing Required Properties
Response
Get a list of OrganisationUnits#
- A list of OrganisationUnits includes all levels of organisationunits in the system including, Regions, Districts, Facilities and all other levels.
Endpoint
Response
Get One OrganisationUnit By ID#
- Details of one OrganisationUnit can retrieved by passing the ID of that OrganisationUnit if available in the system (/api/organisationUnits/ID)
Endpoint
Response
Filter OrganisationUnits#
- Filtering of OrganisationUnits is performed by passing any property of the OrganisationUnits in the structure of the endpoint below.
Endpoint
Response on Success
Response on No Data
Get only desired fields#
- Organisationunits endpoint can be filtered to only include fields you might want to use.
Endpoint
Response
NOTE: All filtering mechanisms, can be combined to produce a lobust search strategy
- Available search and filter Operators
| Operator | Types | Value Required | Description |
|---|---|---|---|
| eq | string | boolean | integer | float | enum | collection (checks for size) | date | true | Equality |
| like | string | true | Case sensitive string, match anywhere |
| ilike | string | true | Case insensitive string, match anywhere |
| in | string | boolean | integer | float | date | true | Find objects matching 1 or more values |
Updating OrganisationUnits#
- Updating an organisationUnit can be performed in two ways
Updating with ID.#
Endpoint
- Where Xm7iba5dFpuZF is the organisationUnit ID
Sample Payload
Response
Updating with code#
Endpoint
- Where MOHCDGEC is the organisationUnit code.
`Sample Payload`
Response
Deleting organisationUnit#
- Deleting organisationUnit can be done in two ways like updating depending on what the user has access to.
NOTE:To avoid orphans in deleting organisationUnits, deleting does not cascade so if you want to delete a parent, make sure it does not have any children.
Deleting with organisationUnit id.#
Endpoint
- Where
DDAVHQaLekWBtis the organisationUnit ID
Response
Deleting with organisationUnit code.#
Endpoint
- Where 19D90-10 is the organisationUnit CODE
Response