The templates serve as blueprints for credentials, defining their attributes.
To create a template the following endpoint can be used.
POST: {{host}}/templates/
DATA:
{
"name": "rcs-battery-manufacturer-scores",
"displayName": "RCS Battery Manufacturer Scores",
"version": "1.0.1",
"decription": "Public",
"type": "RCSScores",
"tags": [
"dpp",
"battery",
"Public",
"Product"
],
"namespace": "rcs",
"jsonSchema": {
"$schema": "<http://json-schema.org/draft-07/schema>",
"title": "Generated schema for Root",
"type": "object",
"properties": {
"greenhouseGasScore": {
"type": "string"
},
"dueDiligenceScore": {
"type": "string"
},
"esgScore": {
"type": "string"
},
"manufacturer": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"address": {
"type": "string"
},
"country": {
"type": "string"
}
},
},
"required": [
"greenhouseGasScore",
"dueDiligenceScore",
"esgScore"
]
}
}
name
and version
tuple is used to uniquely identify the template.jsonSchema
attribute is a JSON schema that defines the attributes of the credential.type
attribute is a string that defines the type of the credential.tags
attribute is an array of strings that can be used to categorize the template.namespace
attribute is a string that defines the namespace of the credential.Right after creation, a template is not yet usable for issuing credentials. It is still in “unpublished” state, i.e. isPublished: false
. This means that changes to the template and its attributes are still permitted.
To update a template, the following endpoint can be used.
PUT: {{host}}/templates/{{template_id}}
DATA: {{same as the create entpoint - all request attributes are optional}}
When a template is ready to be used to create credentials, it can be published using the following endpoint.
PUT: {{host}}/templates/{{template_id}}/publish
Once a template is published, it cannot be changed. When published, the template is assigned a URL. This URL can be used to resolve the template into a JSON-LD credential schema, which is then used for issuing and verifying credentials associated with this template.