8 Service APIs

This section provides a reference for APIs that should be implemented by this Building Block.

The APIs defined here establish a blueprint for how the Building Block will interact with other Building Blocks. Additional APIs may be implemented by the Building Block, but the listed APIs define a minimal set of functionality that should be provided by any implementation of this Building Block.

The GovStack non-functional requirements document provides additional information on how 'adaptors' may be used to translate an existing API to the patterns described here. This section also provides guidance on how candidate products are tested and how GovStack validates a product's API against the API specifications defined here.

The tests for the Digital Registries Building Block can be found in this GitHub repository.

The Digital Registries Building Block may contain multiple registries/databases. The dynamic nature of the database structure requires a standard set of automatically generated APIs for all databases hosted on the platform. The system generates default API method endpoints automatically after each publication of the database schema. A new API service version is generated after each schema publish. Database schema version and API versions are in sync.

The naming convention and structure of the API endpoint are the following:

/{information type}/{registry acronym or code}/{version}/{API method as a name}.

Example 1: ​/api/data​/cr​/1.0​/create

Example 2: ​/api/v1/database/modify

Each registry contains a unique set of data and the Building Block enables an Analyst to change the data storage structure/schema on the fly. In the following example API descriptions are generated for one example dataset for the Postpartum Infant Care Program registry, where the Caretaker and infant child are registered and a registration ID is issued.

Example registry database logical data model.
Example registry database Json schema.

Digital Registries Building Block is expected to host the following API services for each database hosted on the platform.

The API is built using a representational state transfer (REST) software architectural style and described in Open API 3 standard using YAML (a human-readable data-serialization language). Request and response body is in JSON (lightweight data-interchange format).

8.1 Administrative/Analyst Functions

list

get

Searches (Regex supported) and returns multiple records as an array-list.

Authorizations
Path parameters
registryNamestringRequired
versionNumberstringRequired
Query parameters
searchstringOptional

Field for searching random string type data from database

Example: John
filterstringOptional

Field name that user wishes to filter

Example: FirstName
orderingstringOptional

How user wishes to order the data

Example: descending
pageintegerOptional

Result page number

Example: 1
pageSizeintegerOptional

Number of results on one page

Example: 10
query.<fieldName>stringRead-onlyOptional

Example of searchable database field. If more searchable fields are in DB, then more similar fields will follow in input

Example: Value can be in any supported format, for an example 'string'
Header parameters
Information-Mediator-ClientstringRequired

Format is: INSTANCE/CLASS/MEMBER/SUBSYSTEM

Example: eGovStack/GOV/90000009/digitalregistries
Responses
200Success
application/json
get
GET /data/{registryName}/{versionNumber} HTTP/1.1
Host: 
Authorization: YOUR_API_KEY
Information-Mediator-Client: text
Accept: */*
200Success
{
  "count": 1,
  "next": 1,
  "previous": "https://example.com",
  "results": [
    {
      "id": "EE378627348834",
      "firstName": "John Helmut",
      "lastName": "Smith Carry",
      "birthCertificateId": "RR-1234567889"
    }
  ]
}

read

post

Searches and returns one record.

Authorizations
Path parameters
registryNamestringRequired
versionNumberstringRequired
Header parameters
Information-Mediator-ClientstringRequired

Format is: INSTANCE/CLASS/MEMBER/SUBSYSTEM

Example: eGovStack/GOV/90000009/digitalregistries
Body
Responses
200Success
application/json
post
POST /data/{registryName}/{versionNumber}/read HTTP/1.1
Host: 
Authorization: YOUR_API_KEY
Information-Mediator-Client: text
Content-Type: application/json
Accept: */*
Content-Length: 133

{
  "query": {
    "content": {
      "id": "EE378627348834",
      "firstName": "John Helmut",
      "lastName": "Smith Carry",
      "birthCertificateId": "RR-1234567889"
    }
  }
}
{
  "content": {
    "id": "EE378627348834",
    "firstName": "John Helmut",
    "lastName": "Smith Carry",
    "birthCertificateId": "RR-1234567889"
  }
}

update

put

Updates one existing record in the registry database.

Authorizations
Path parameters
registryNamestringRequired
versionNumberstringRequired
Header parameters
Information-Mediator-ClientstringRequired

Format is: INSTANCE/CLASS/MEMBER/SUBSYSTEM

Example: eGovStack/GOV/90000009/digitalregistries
Body
Responses
200Success
put
PUT /data/{registryName}/{versionNumber}/update HTTP/1.1
Host: 
Authorization: YOUR_API_KEY
Information-Mediator-Client: text
Content-Type: application/json
Accept: */*
Content-Length: 265

{
  "query": {
    "content": {
      "id": "EE378627348834",
      "firstName": "John Helmut",
      "lastName": "Smith Carry",
      "birthCertificateId": "RR-1234567889"
    }
  },
  "write": {
    "content": {
      "id": "EE378627348834",
      "firstName": "John Helmut",
      "lastName": "Smith Carry",
      "birthCertificateId": "RR-1234567889"
    }
  }
}
200Success

No content

updateEntries

put

Updates multiple records in the registry database that match the input query.

Authorizations
Path parameters
registryNamestringRequired
versionNumberstringRequired
Header parameters
Information-Mediator-ClientstringRequired

Format is: INSTANCE/CLASS/MEMBER/SUBSYSTEM

Example: eGovStack/GOV/90000009/digitalregistries
Body
Responses
200Success
put
PUT /data/{registryName}/{versionNumber}/updateEntries HTTP/1.1
Host: 
Authorization: YOUR_API_KEY
Information-Mediator-Client: text
Content-Type: application/json
Accept: */*
Content-Length: 265

{
  "query": {
    "content": {
      "id": "EE378627348834",
      "firstName": "John Helmut",
      "lastName": "Smith Carry",
      "birthCertificateId": "RR-1234567889"
    }
  },
  "write": {
    "content": {
      "id": "EE378627348834",
      "firstName": "John Helmut",
      "lastName": "Smith Carry",
      "birthCertificateId": "RR-1234567889"
    }
  }
}
200Success

No content

update-or-create

post

API updates existing record if matching with input parameters is successful. If record is not found the API will create a new record.

Authorizations
Path parameters
registryNamestringRequired
versionNumberstringRequired
Header parameters
Information-Mediator-ClientstringRequired

Format is: INSTANCE/CLASS/MEMBER/SUBSYSTEM

Example: eGovStack/GOV/90000009/digitalregistries
Body
Responses
200Success
application/json
post
POST /data/{registryName}/{versionNumber}/updateOrCreate HTTP/1.1
Host: 
Authorization: YOUR_API_KEY
Information-Mediator-Client: text
Content-Type: application/json
Accept: */*
Content-Length: 265

{
  "query": {
    "content": {
      "id": "EE378627348834",
      "firstName": "John Helmut",
      "lastName": "Smith Carry",
      "birthCertificateId": "RR-1234567889"
    }
  },
  "write": {
    "content": {
      "id": "EE378627348834",
      "firstName": "John Helmut",
      "lastName": "Smith Carry",
      "birthCertificateId": "RR-1234567889"
    }
  }
}
200Success
{
  "content": {
    "id": "EE378627348834",
    "firstName": "John Helmut",
    "lastName": "Smith Carry",
    "birthCertificateId": "RR-1234567889"
  }
}

8.2 Applicant Functions

exists

post

Searches records based on input parameters and returns boolean answer (true/false).

Authorizations
Path parameters
registryNamestringRequired
versionNumberstringRequired
Header parameters
Information-Mediator-ClientstringRequired

Format is: INSTANCE/CLASS/MEMBER/SUBSYSTEM

Example: eGovStack/GOV/90000009/digitalregistries
Body
Responses
200Success
application/json
post
POST /data/{registryName}/{versionNumber}/exists HTTP/1.1
Host: 
Authorization: YOUR_API_KEY
Information-Mediator-Client: text
Content-Type: application/json
Accept: */*
Content-Length: 133

{
  "query": {
    "content": {
      "id": "EE378627348834",
      "firstName": "John Helmut",
      "lastName": "Smith Carry",
      "birthCertificateId": "RR-1234567889"
    }
  }
}
200Success
{
  "answer": {
    "status": true,
    "message": "Object found from database"
  }
}

delete

delete

Delete record.

Authorizations
Path parameters
registryNamestringRequired
versionNumberstringRequired
idstringRequired

ID of the citizen that needs to be deleted from the Registry data query API

Example: ID1
Header parameters
Information-Mediator-ClientstringRequired

Format is: INSTANCE/CLASS/MEMBER/SUBSYSTEM

Example: eGovStack/GOV/90000009/digitalregistries
Responses
204Success
delete
DELETE /data/{registryName}/{versionNumber}/{id}/delete HTTP/1.1
Host: 
Authorization: YOUR_API_KEY
Information-Mediator-Client: text
Accept: */*
204Success

No content

readValue

get

Searches and returns one record’s one field value.

Authorizations
Path parameters
registryNamestringRequired
versionNumberstringRequired
uuidstringRequired

Primary key field

Example: DB-1
fieldstringRequired

Data format. Endpoint: /data/DB/1.0/DB-1/read-value/First%20name.json

Example: First name
extstringRequired

Data format. Endpoint: /data/DB/1.0/DB-1/read-value/First%20name.json

Example: json
Header parameters
Information-Mediator-ClientstringRequired

Format is: INSTANCE/CLASS/MEMBER/SUBSYSTEM

Example: eGovStack/GOV/90000009/digitalregistries
Responses
200Success
application/json
Responseany of
stringOptional
or
get
GET /data/{registryName}/{versionNumber}/{uuid}/readValue/{field}.{ext} HTTP/1.1
Host: 
Authorization: YOUR_API_KEY
Information-Mediator-Client: text
Accept: */*
200Success
text
get

Allows a user to see who has read their personal data.

Query parameters
userIdstringRequired

User's personal unique identifier

Example: EE378129277266
databaseIdstringRequired

Database acronym

Example: MCTS
Header parameters
Information-Mediator-ClientstringRequired

Format is: INSTANCE/CLASS/MEMBER/SUBSYSTEM

Example: eGovStack/GOV/90000009/digitalregistries
Responses
200
Success Response
application/json
get
GET /data/mypersonalDataUsage?userId=EE378129277266&databaseId=MCTS HTTP/1.1
Host: 
Information-Mediator-Client: text
Accept: */*
[
  {
    "id": "1234567",
    "readerId": "EE37819285773",
    "readerInitials": "JD",
    "readerInstitutionId": "EE70049837",
    "readerInstitutionName": "East Hospital",
    "readerApplicationName": "East Hospital healthcare back office",
    "searchDateTime": "2017-07-21T17:32:28Z",
    "refrences": []
  }
]
get

API endpoint that allows user to get database information with schema

Authorizations
Path parameters
idintegerRequired

Id of the database that schema is requested

Example: 1
Header parameters
Information-Mediator-ClientstringRequired

Format is: INSTANCE/CLASS/MEMBER/SUBSYSTEM

Example: eGovStack/GOV/90000009/eregistrations-dev
Responses
200Success
application/json
get
GET /database/{id} HTTP/1.1
Host: 
Authorization: YOUR_API_KEY
Information-Mediator-Client: text
Accept: */*
200Success
{
  "id": 353,
  "version": "2.7",
  "name": "MCTS",
  "description": "Database holding information about MCTS objects",
  "institution": "Ministry of Social Affairs",
  "numberFormat": "{code}{indexNoByCode}",
  "schema": {
    "id": 85,
    "name": "Mother and Child",
    "code": "MCTS",
    "databases": [
      {
        "id": 353,
        "version": "2.7",
        "name": "MCTS",
        "description": "Database holding information about MCTS objects",
        "institution": "Ministry of Social Affairs",
        "numberFormat": "{code}{indexNoByCode}",
        "schema": {
          "id": 85,
          "name": "Mother and Child",
          "code": "MCTS",
          "databases": [
            "[Circular Reference]"
          ],
          "groupId": 10,
          "order": 76,
          "dataIndexIncrement": 3
        },
        "schemaTags": [
          {
            "name": "",
            "path": "/Child/Citizenship",
            "isFulltext": true
          }
        ],
        "schemaFlags": [
          {
            "name": "mandatory",
            "path": "/ID"
          }
        ],
        "fieldsUniques": [
          [
            ""
          ]
        ],
        "isDraft": false,
        "isDisabled": false,
        "isArchived": false,
        "modifiedAt": "2021-10-03T08:35:01.775915Z",
        "byUserName": "ingmar.dev",
        "byUserAuthId": 1,
        "byOnBehalfOfUserAuthId": 0,
        "byOnBehalfOfUserName": null,
        "genericServices": [
          {
            "serviceId": 1,
            "name": "data-create",
            "isVisible": true,
            "usedCount": 0
          }
        ],
        "dataIndexIncrement": 0,
        "hasLogo": false
      }
    ],
    "groupId": 10,
    "order": 76,
    "dataIndexIncrement": 3
  },
  "schemaTags": [
    {
      "name": "",
      "path": "/Child/Citizenship",
      "isFulltext": true
    }
  ],
  "schemaFlags": [
    {
      "name": "mandatory",
      "path": "/ID"
    }
  ],
  "fieldsUniques": [
    [
      ""
    ]
  ],
  "isDraft": false,
  "isDisabled": false,
  "isArchived": false,
  "modifiedAt": "2021-10-03T08:35:01.775915Z",
  "byUserName": "ingmar.dev",
  "byUserAuthId": 1,
  "byOnBehalfOfUserAuthId": 0,
  "byOnBehalfOfUserName": null,
  "genericServices": [
    {
      "serviceId": 1,
      "name": "data-create",
      "isVisible": true,
      "usedCount": 0
    }
  ],
  "dataIndexIncrement": 0,
  "hasLogo": false
}
delete

API endpoint that allows user to delete database schema

Authorizations
Path parameters
idintegerRequired

Id of the database that schema is requested

Example: 1
Header parameters
Information-Mediator-ClientstringRequired

Format is: INSTANCE/CLASS/MEMBER/SUBSYSTEM

Example: eGovStack/GOV/90000009/eregistrations-dev
Responses
200
Success
application/json
ResponsestringExample: Success
delete
DELETE /database/{id} HTTP/1.1
Host: 
Authorization: YOUR_API_KEY
Information-Mediator-Client: text
Accept: */*
200

Success

Success
post

API endpoint that allows user to create or modify database schema

Header parameters
Information-Mediator-ClientstringRequired

Format is: INSTANCE/CLASS/MEMBER/SUBSYSTEM

Example: eGovStack/GOV/90000009/eregistrations-dev
Body
groupNamestringOptional

Group name where this schema is located

Example: Test
catalogNamestringOptional

Catalog name where this schema is located

Example: Mother and Child
codestringOptional

Short code of the database

Example: MCR
schemaall ofOptional
Responses
200
Success
application/json
post
POST /database/modify HTTP/1.1
Host: 
Information-Mediator-Client: text
Content-Type: application/json
Accept: */*
Content-Length: 518

{
  "groupName": "Test",
  "catalogName": "Mother and Child",
  "code": "MCR",
  "schema": {
    "type": "object",
    "properties": {
      "ID": {
        "type": "string",
        "triggers": [
          {
            "conditions": [
              {
                "logic": "==",
                "value": "",
                "gate": "&&"
              }
            ],
            "actions": [
              {
                "type": "set-value",
                "value": "MCTS{indexNoByCode}",
                "field_id": 1
              }
            ]
          }
        ],
        "primaryKey": true,
        "readOnly": true,
        "description": "Registration ID",
        "example": "MCTS31",
        "id": 1
      },
      "child": {
        "type": "string",
        "properties": {
          "id": {
            "type": "string",
            "description": "Child ID",
            "example": "ID2",
            "id": 13
          }
        }
      }
    },
    "incrementIndex": 20,
    "required": [
      "ID"
    ]
  }
}
200

Success

{
  "type": "object",
  "properties": {
    "ID": {
      "type": "string",
      "triggers": [
        {
          "conditions": [
            {
              "logic": "==",
              "value": "",
              "gate": "&&"
            }
          ],
          "actions": [
            {
              "type": "set-value",
              "value": "MCTS{indexNoByCode}",
              "field_id": 1
            }
          ]
        }
      ],
      "primaryKey": true,
      "readOnly": true,
      "description": "Registration ID",
      "example": "MCTS31",
      "id": 1
    },
    "child": {
      "type": "string",
      "properties": {
        "id": {
          "type": "string",
          "description": "Child ID",
          "example": "ID2",
          "id": 13
        }
      }
    }
  },
  "incrementIndex": 20,
  "required": [
    "ID"
  ]
}
get

API endpoint that allows user to get information about all databases

Authorizations
Header parameters
Information-Mediator-ClientstringRequired

Format is: INSTANCE/CLASS/MEMBER/SUBSYSTEM

Example: eGovStack/GOV/90000009/eregistrations-dev
Responses
200Success
application/json
get
GET /databases HTTP/1.1
Host: 
Authorization: YOUR_API_KEY
Information-Mediator-Client: text
Accept: */*
200Success
{
  "id": 85,
  "name": "Mother and Child",
  "code": "MCTS",
  "databases": [
    {
      "id": 353,
      "version": "2.7",
      "name": "MCTS",
      "description": "Database holding information about MCTS objects",
      "institution": "Ministry of Social Affairs",
      "numberFormat": "{code}{indexNoByCode}",
      "schema": {
        "id": 85,
        "name": "Mother and Child",
        "code": "MCTS",
        "databases": [
          {
            "id": 353,
            "version": "2.7",
            "name": "MCTS",
            "description": "Database holding information about MCTS objects",
            "institution": "Ministry of Social Affairs",
            "numberFormat": "{code}{indexNoByCode}",
            "schema": "[Circular Reference]",
            "schemaTags": [
              {
                "name": "",
                "path": "/Child/Citizenship",
                "isFulltext": true
              }
            ],
            "schemaFlags": [
              {
                "name": "mandatory",
                "path": "/ID"
              }
            ],
            "fieldsUniques": [
              [
                ""
              ]
            ],
            "isDraft": false,
            "isDisabled": false,
            "isArchived": false,
            "modifiedAt": "2021-10-03T08:35:01.775915Z",
            "byUserName": "ingmar.dev",
            "byUserAuthId": 1,
            "byOnBehalfOfUserAuthId": 0,
            "byOnBehalfOfUserName": null,
            "genericServices": [
              {
                "serviceId": 1,
                "name": "data-create",
                "isVisible": true,
                "usedCount": 0
              }
            ],
            "dataIndexIncrement": 0,
            "hasLogo": false
          }
        ],
        "groupId": 10,
        "order": 76,
        "dataIndexIncrement": 3
      },
      "schemaTags": [
        {
          "name": "",
          "path": "/Child/Citizenship",
          "isFulltext": true
        }
      ],
      "schemaFlags": [
        {
          "name": "mandatory",
          "path": "/ID"
        }
      ],
      "fieldsUniques": [
        [
          ""
        ]
      ],
      "isDraft": false,
      "isDisabled": false,
      "isArchived": false,
      "modifiedAt": "2021-10-03T08:35:01.775915Z",
      "byUserName": "ingmar.dev",
      "byUserAuthId": 1,
      "byOnBehalfOfUserAuthId": 0,
      "byOnBehalfOfUserName": null,
      "genericServices": [
        {
          "serviceId": 1,
          "name": "data-create",
          "isVisible": true,
          "usedCount": 0
        }
      ],
      "dataIndexIncrement": 0,
      "hasLogo": false
    }
  ],
  "groupId": 10,
  "order": 76,
  "dataIndexIncrement": 3
}

list

get

Searches (Regex supported) and returns multiple records as an array-list.

Authorizations
Path parameters
registryNamestringRequired
versionNumberstringRequired
Query parameters
searchstringOptional

Field for searching random string type data from database

Example: John
filterstringOptional

Field name that user wishes to filter

Example: FirstName
orderingstringOptional

How user wishes to order the data

Example: descending
pageintegerOptional

Result page number

Example: 1
pageSizeintegerOptional

Number of results on one page

Example: 10
query.<fieldName>stringRead-onlyOptional

Example of searchable database field. If more searchable fields are in DB, then more similar fields will follow in input

Example: Value can be in any supported format, for an example 'string'
Header parameters
Information-Mediator-ClientstringRequired

Format is: INSTANCE/CLASS/MEMBER/SUBSYSTEM

Example: eGovStack/GOV/90000009/digitalregistries
Responses
200Success
application/json
get
GET /data/{registryName}/{versionNumber} HTTP/1.1
Host: 
Authorization: YOUR_API_KEY
Information-Mediator-Client: text
Accept: */*
200Success
{
  "count": 1,
  "next": 1,
  "previous": "https://example.com",
  "results": [
    {
      "id": "EE378627348834",
      "firstName": "John Helmut",
      "lastName": "Smith Carry",
      "birthCertificateId": "RR-1234567889"
    }
  ]
}
post
Header parameters
Information-Mediator-ClientstringRequired

Format is: INSTANCE/CLASS/MEMBER/SUBSYSTEM

Example: eGovStack/GOV/90000009/digitalregistries
Body
Responses
201Success
application/json
post
POST /data/mcts/createEntries HTTP/1.1
Host: 
Information-Mediator-Client: text
Content-Type: application/json
Accept: */*
Content-Length: 639

{
  "write": [
    {
      "content": {
        "start": "2021-10-03T07:03:36Z",
        "expiry": "2021-10-03T07:03:36Z",
        "child": {
          "citizenId": "ID2",
          "firstName": "Usha",
          "lastNames": "Bajaj",
          "birthdate": "2021-10-03T07:03:36Z",
          "address": "Longroad 123, Welltown, Ethiopia",
          "nationality": "ET",
          "birthCertificate": {
            "url": "text",
            "originalName": "text",
            "type": "text"
          },
          "gender": "Male"
        },
        "caretaker": {
          "citizenId": "ID1",
          "firstName": "Sowmya",
          "lastNames": "Bajaj",
          "birthdate": "2021-10-03T07:03:36Z",
          "phone": "+3725278511",
          "email": "test@test.et",
          "picture": {
            "url": "text",
            "originalName": "text",
            "type": "text"
          },
          "citizenIdDoc": {
            "url": "text",
            "originalName": "text",
            "type": "text"
          }
        },
        "paymentId": "text"
      }
    }
  ]
}
201Success
{
  "receive": [
    {
      "content": {
        "id": "MCTS31",
        "start": "2021-10-03T07:03:36Z",
        "expiry": "2021-10-03T07:03:36Z",
        "child": {
          "citizenId": "ID2",
          "firstName": "Usha",
          "lastNames": "Bajaj",
          "birthdate": "2021-10-03T07:03:36Z",
          "address": "Longroad 123, Welltown, Ethiopia",
          "nationality": "ET",
          "birthCertificate": {
            "url": "text",
            "originalName": "text",
            "type": "text"
          },
          "gender": "Male"
        },
        "caretaker": {
          "citizenId": "ID1",
          "firstName": "Sowmya",
          "lastNames": "Bajaj",
          "birthdate": "2021-10-03T07:03:36Z",
          "phone": "+3725278511",
          "email": "test@test.et",
          "picture": {
            "url": "text",
            "originalName": "text",
            "type": "text"
          },
          "citizenIdDoc": {
            "url": "text",
            "originalName": "text",
            "type": "text"
          }
        },
        "paymentId": "text"
      },
      "createdAt": "2025-06-25T19:26:32.848Z",
      "modifiedAt": "2025-06-25T19:26:32.848Z",
      "uuid": "123e4567-e89b-12d3-a456-426614174000"
    }
  ]
}

read

post

Searches and returns one record.

Authorizations
Path parameters
registryNamestringRequired
versionNumberstringRequired
Header parameters
Information-Mediator-ClientstringRequired

Format is: INSTANCE/CLASS/MEMBER/SUBSYSTEM

Example: eGovStack/GOV/90000009/digitalregistries
Body
Responses
200Success
application/json
post
POST /data/{registryName}/{versionNumber}/read HTTP/1.1
Host: 
Authorization: YOUR_API_KEY
Information-Mediator-Client: text
Content-Type: application/json
Accept: */*
Content-Length: 133

{
  "query": {
    "content": {
      "id": "EE378627348834",
      "firstName": "John Helmut",
      "lastName": "Smith Carry",
      "birthCertificateId": "RR-1234567889"
    }
  }
}
{
  "content": {
    "id": "EE378627348834",
    "firstName": "John Helmut",
    "lastName": "Smith Carry",
    "birthCertificateId": "RR-1234567889"
  }
}

Last updated

Was this helpful?