Search…
How to set up update certificates API

Overview

This document will help an implementer configure the following service:
  • Update certificates

API

  • The DIVOC platform provides API services for updating vaccination certificates. You can refer to the API service call ‘​/v3​/certificate’ for the method PUT here.
  • The payload of the update service is the same as that of the certificate generation request. Click here to know more.
  • The platform provides flexibility to update values in the ‘recipient,’ ‘vaccination,’ ‘vaccinator,’ and ‘facility’ sections. Click here if you want to understand the mandatory and non-mandatory information that should be there in a vaccination certificate, according to global standards.

Key Functionality

  • Update the existing certificate along with its QR code.

Prerequisite: Get details on the API request and field validations:

a. The update certificate request is processed in this function. The pre-enrollment code and dose-wise certificates will be searched in the system to make an update request. The function will trigger the subsequent process to update the certificates.
1
for _, request := range params.Body {
2
if certificateId := getCertificateIdToBeUpdated(request); certificateId != nil{
3
log.Infof("Certificate update request approved %+v", request)
4
if request.Meta == nil {
5
request.Meta = map[string]interface{}{
6
"previousCertificateId": certificateId,
7
"certificateType": CERTIFICATE_TYPE_V3,
8
}
9
} else {
10
meta := request.Meta.(map[string]interface{})
11
meta["previousCertificateId"] = certificateId
12
meta["certificateType"] = CERTIFICATE_TYPE_V3
13
}
14
if jsonRequestString, err := json.Marshal(request); err == nil {
15
kafkaService.PublishCertifyMessage(jsonRequestString, nil, nil)
16
}
17
} else {
18
log.Infof("Certificate update request rejected %+v", request)
19
return certification.NewUpdateCertificateV3PreconditionFailed()
20
}
21
}
22
return certification.NewUpdateCertificateV3OK()
Copied!
b. The platform provides the flexibility to restrict the number of update requests to avoid misuse of the functionality in generating multiple certificates.

Example:

Configure the limit of update certificate requests to only five where the user can only update a certificate five times.

Steps

Step 1: Open this file and check the function that will limit the number of certificates being updated.
1
if count < (config.Config.Certificate.UpdateLimit + 1) {
2
certificateId := doseWiseCertificateIds[int(*request.Vaccination.Dose)][count-1]
3
return &certificateId
4
} else {
5
log.Error("Certificate update limit reached")
6
}
Copied!
Step 2: Open this file and update the limit by configuring CERTIFICATE_UPDATE_LIMIT.
1
UpdateLimit int `env:"CERTIFICATE_UPDATE_LIMIT" default:"5"`
Copied!
All content on this page by eGov Foundation is licensed under a Creative Commons Attribution 4.0 International License.
Last modified 8d ago