Upload certificate: Using Asset API
- 1 Introduction:
- 2 Background:
- 3 Problem Statement:
- 4 Key design problems:
- 5 How to get certificates using asset API
- 5.1 Curl:
- 6 How to get default certificate layouts using asset API?
- 7 How to upload/create a new certificate template using a certificate layout(asset) or existing certificate template?
- 8 How to upload/create an asset(used for uploading logos, signatures)
- 9 How to copy & use the existing certificate template
- 10 How to get asset details(for do_id)
- 10.1 Curl:
Introduction:
This document describes how to upload certificate & use asset API’s for certificate
Background:
Jira Issue https://project-sunbird.atlassian.net/browse/SH-1228?
Problem Statement:
How to upload certificate using asset API
Key design problems:
How to get a certificate using asset API(deprecate the existing preference API)
How to get default certificate layouts using asset API?
How to upload/create new certificate template using certificate layout(asset) or existing certificate template?
Attaching cert to a batch(till R3.3.0):
The below code is used to attach certificate to a batch(without using asset API)
{
"identifier": "template_01_preprod_001",
"criteria": {
"enrollment": {
"status": 2
}
},
"name": "Course completion certificate",
"issuer": {
"name": "Gujarat Council of Educational Research and Training",
"url": "https://gcert.gujarat.gov.in/gcert/"
},
"signatoryList": [
{
"image": "https://cdn.pixabay.com/photo/2014/11/09/08/06/signature-523237__340.jpg",
"name": "CEO Gujarat",
"id": "CEO",
"designation": "CEO"
}
],
"notifyTemplate": {
"subject": "Completion certificate",
"stateImgUrl": "https://sunbirddev.blob.core.windows.net/orgemailtemplate/img/File-0128212938260643843.png",
"regardsperson": "Chairperson",
"regards": "Minister of Gujarat",
"emailTemplateType": "defaultCertTemp"
}
}
How to get certificates using asset API
To get all the certificate templates or layouts use the search
API call with filters certType
& channel
“certType”: | Description |
---|---|
“cert template” | to get all the actual certificate templates that can attach to a batch |
“cert template layout” | to get all the certificate template layouts that can be used to create a new certificate template |
“channel”: is used in the filter to get the certificate templates/layouts specific to channel
API endpoint:
POST: /api/content/v1/search
API request body:
{
"request": {
"filters":{
"certType": "cert template",
"channel": "in.ekstep"
},
"fields": ["indentifier","name","code","certType","data","issuer","signatoryList","artifactUrl","primaryCategory","channel"],
"limit": 100
}
}
Response :
Curl:
How to get default certificate layouts using asset API?
Same as API search
API with only change "certType": ”cert template layout”
.
How to upload/create a new certificate template using a certificate layout(asset) or existing certificate template?
Create API (logo/signature create to get do_Id)
API endpoint:
API request:
API response:
Curl:
Upload API (logo/signature upload to blob storage to get artifactUrl)
API endpoint:
API request:
API response:
Curl:
How to upload/create an asset(used for uploading logos, signatures)
Create API (logo/signature create to get do_Id)
Upload Image | Primary Category | Description |
---|---|---|
Logos | Asset | Publicly accessible to any user. |
Signature | CertAsset | To avoid showing these images in any other asset browsers. These images should be private. Laster release we will use as “base64” string instead of uploading to blob. |
API endpoint:
API request:
API response:
Curl:
Upload API (logo/signature upload to blob storage to get artifactUrl
)
API endpoint:
API request:
API response:
Curl:
How to copy & use the existing certificate template
API endpoint:
API request:
API response:
How to get asset details(for do_id)
This is to get the details of the asset/certificate by using do_id
API endpoint:
API response:
Curl:
Related articles:
Certificate: Attach to a batch