Templates

The templates serve as blueprints for credentials, defining their attributes.

Create

To create a template the following endpoint can be used:

Example request

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"
    ]
  }
}
  • The name and version tuple is used to uniquely identify the template.
  • The jsonSchema attribute is a JSON schema that defines the attributes of the credential.
  • The type attribute is a string that defines the type of the credential.
  • The tags attribute is an array of strings that can be used to categorize the template.
  • The namespace attribute is a string that defines the namespace of the credential.

Update

Right after creation, a template is not yet usable for issuing credentials; it is still in “unpublished” state 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}}

Publish

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 JsonLD credential schema, which is then used for issuing and verifying credentials associated with this template.

Was this page helpful?