LogoLogo
Give FeedbackGovStack Home
1.0
1.0
  • Digital Registries
  • 1 Version History
  • 2 Description
  • 3 Terminology
  • 4 Key Digital Functionalities
  • 5 Cross-Cutting Requirements
  • 6 Functional Requirements
  • 7 Data Structures
  • 8 Service APIs
  • 9 Internal Workflows
  • 10 Other Resources
Powered by GitBook

Copyright © 2024

On this page

Was this helpful?

Export as PDF

8 Service APIs

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

Last updated 1 year ago

Was this helpful?

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 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 .

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.

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

8.1 Administrative/Analyst Functions

8.2 Applicant Functions

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

REST
Open API 3 standard
YAML
JSON
GovStack non-functional requirements document
this GitHub repository
Example registry database logical data model.
Example registry database Json schema.
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": {
    "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"
    ]
  },
  "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,
  "generic_Services": [
    {
      "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
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
Responseany
get
GET /databases HTTP/1.1
Host: 
Authorization: YOUR_API_KEY
Information-Mediator-Client: text
Accept: */*
200Success

No content

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"
  ]
}
  • 8.1 Administrative/Analyst Functions
  • 8.2 Applicant Functions
  • GET/database/{id}
  • POST/database/modify
  • DELETE/database/{id}
  • GET/databases