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 documentarrow-up-right 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 repositoryarrow-up-right.

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 (RESTarrow-up-right) software architectural style and described in Open API 3 standardarrow-up-right using YAMLarrow-up-right (a human-readable data-serialization language). Request and response body is in JSONarrow-up-right (lightweight data-interchange format).

8.1 Administrative/Analyst Functions

8.2 Applicant Functions

get

API endpoint that allows user to get database information with schema

Authorizations
AuthorizationstringRequired
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
chevron-right
200Success
application/json
idintegerOptional

Database ID

Example: 353
versionstringOptional

Database version number

Example: 2.7
namestringOptional

Database name

Example: MCTS
descriptionstringOptional

Database description

Example: Database holding information about MCTS objects
institutionstringOptional

Owner of the database (institution)

Example: Ministry of Social Affairs
numberFormatstringOptional

Number format in database

Example: {code}{indexNoByCode}
isDraftbooleanOptional

Shows database draft status (is draft true/false)

Example: false
isDisabledbooleanOptional

Shows if database is disabled or not

Example: false
isArchivedbooleanOptional

Shows if database is archived or not

Example: false
modifiedAtstringOptional

Shows database last modification time

Example: 2021-10-03T08:35:01.775915Z
byUserNamestringOptional

Shows user name of a person who created the database

Example: ingmar.dev
byUserAuthIdintegerOptional

Shows id of a person who created the database

Example: 1
byOnBehalfOfUserAuthIdintegerOptional

Shows user id whose behalf was this database created

Example: 0
byOnBehalfOfUserNamestringOptional

Shows user name whose behalf was this database created

dataIndexIncrementintegerOptional

Shows database increment

Example: 0
hasLogobooleanOptional

Shows if this database has logo or not

Example: false
get
/database/{id}
200Success
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
Responses
chevron-right
200

Success

application/json

Schema object describing the database

typestringOptionalExample: object
incrementIndexintegerOptionalExample: 20
requiredstring[]OptionalExample: ID
post
/database/modify
200

Success

delete

API endpoint that allows user to delete database schema

Authorizations
AuthorizationstringRequired
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
chevron-right
200

Success

application/json
stringOptionalExample: Success
delete
/database/{id}
200

Success

get

API endpoint that allows user to get information about all databases

Authorizations
AuthorizationstringRequired
Header parameters
Information-Mediator-ClientstringRequired

Format is: INSTANCE/CLASS/MEMBER/SUBSYSTEM

Example: eGovStack/GOV/90000009/eregistrations-dev
Responses
chevron-right
200Success
application/json
anyOptional
get
/databases
200Success

No content

Last updated

Was this helpful?