Credential Schema APIs
Last updated
Last updated
GET /api/v1/credential-schema/{id} HTTP/1.1
Host: sunbirdrc.dev
Token: YOUR_API_KEY
Accept: */*
{
"schema": {
"type": "text",
"id": "did:cred-schema:MDP8AsFhHzhwUvGNuYkX7T/06e126d1-fa44-4882-a243-1e326fbe21db;version=1.1",
"version": "text",
"name": "text",
"author": "text",
"authored": "text",
"schema": "{\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"description\":\"Email\",\"type\":\"object\",\"properties\":{\"emailAddress\":{\"type\":\"string\",\"format\":\"email\"}},\"required\":[\"emailAddress\"],\"additionalProperties\":false}",
"proof": {}
},
"tags": [
"text"
],
"status": "DRAFT",
"createdAt": "text",
"updatedAt": "text",
"createdBy": "text",
"updatedBy": "text"
}
GET /api/v1/template HTTP/1.1
Host: sunbirdrc.dev
Token: YOUR_API_KEY
Accept: */*
{
"template": "text",
"schemaId": "did:cred-schema:MDP8AsFhHzhwUvGNuYkX7T/06e126d1-fa44-4882-a243-1e326fbe21db;version=1.1",
"templateId": "did:cred-template:MDP8AsFhHzhwUvGNuYkX7T/06e126d1-fa44-4882-a243-1e326fbe21dc;version=1.1",
"createdAt": "text",
"updatedAt": "text",
"createdBy": "text",
"updatedBy": "text"
}
GET /api/v1/template/{id} HTTP/1.1
Host: sunbirdrc.dev
Token: YOUR_API_KEY
Accept: */*
{
"template": "text",
"schemaId": "did:cred-schema:MDP8AsFhHzhwUvGNuYkX7T/06e126d1-fa44-4882-a243-1e326fbe21db;version=1.1",
"templateId": "did:cred-template:MDP8AsFhHzhwUvGNuYkX7T/06e126d1-fa44-4882-a243-1e326fbe21dc;version=1.1",
"createdAt": "text",
"updatedAt": "text",
"createdBy": "text",
"updatedBy": "text"
}
tag1,tag2
GET /api/v1/credential-schema HTTP/1.1
Host: sunbirdrc.dev
Token: YOUR_API_KEY
Accept: */*
[
{
"schema": {
"type": "text",
"id": "did:cred-schema:MDP8AsFhHzhwUvGNuYkX7T/06e126d1-fa44-4882-a243-1e326fbe21db;version=1.1",
"version": "text",
"name": "text",
"author": "text",
"authored": "text",
"schema": "{\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"description\":\"Email\",\"type\":\"object\",\"properties\":{\"emailAddress\":{\"type\":\"string\",\"format\":\"email\"}},\"required\":[\"emailAddress\"],\"additionalProperties\":false}",
"proof": {}
},
"tags": [
"text"
],
"status": "DRAFT",
"createdAt": "text",
"updatedAt": "text",
"createdBy": "text",
"updatedBy": "text"
}
]
POST /api/v1/credential-schema HTTP/1.1
Host: sunbirdrc.dev
Token: YOUR_API_KEY
Content-Type: appliation/json
Accept: */*
Content-Length: 479
{
"schema": {
"type": "text",
"id": "did:cred-schema:MDP8AsFhHzhwUvGNuYkX7T/06e126d1-fa44-4882-a243-1e326fbe21db;version=1.1",
"version": "text",
"name": "text",
"author": "text",
"authored": "text",
"schema": "{\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"description\":\"Email\",\"type\":\"object\",\"properties\":{\"emailAddress\":{\"type\":\"string\",\"format\":\"email\"}},\"required\":[\"emailAddress\"],\"additionalProperties\":false}"
},
"tags": [
"text"
],
"status": "DRAFT"
}
{
"schema": {
"type": "text",
"id": "did:cred-schema:MDP8AsFhHzhwUvGNuYkX7T/06e126d1-fa44-4882-a243-1e326fbe21db;version=1.1",
"version": "text",
"name": "text",
"author": "text",
"authored": "text",
"schema": "{\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"description\":\"Email\",\"type\":\"object\",\"properties\":{\"emailAddress\":{\"type\":\"string\",\"format\":\"email\"}},\"required\":[\"emailAddress\"],\"additionalProperties\":false}",
"proof": {}
},
"tags": [
"text"
],
"status": "DRAFT",
"createdAt": "text",
"updatedAt": "text",
"createdBy": "text",
"updatedBy": "text"
}
If the schema is updated, a new semver will be generated and the old one will be deprecated. If only metadata (like tags/status) is updated, the semver will not be generated
PUT /api/v1/credential-schema/{id} HTTP/1.1
Host: sunbirdrc.dev
Token: YOUR_API_KEY
Content-Type: appliation/json
Accept: */*
Content-Length: 479
{
"schema": {
"type": "text",
"id": "did:cred-schema:MDP8AsFhHzhwUvGNuYkX7T/06e126d1-fa44-4882-a243-1e326fbe21db;version=1.1",
"version": "text",
"name": "text",
"author": "text",
"authored": "text",
"schema": "{\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"description\":\"Email\",\"type\":\"object\",\"properties\":{\"emailAddress\":{\"type\":\"string\",\"format\":\"email\"}},\"required\":[\"emailAddress\"],\"additionalProperties\":false}"
},
"tags": [
"text"
],
"status": "DRAFT"
}
{
"schema": {
"type": "text",
"id": "did:cred-schema:MDP8AsFhHzhwUvGNuYkX7T/06e126d1-fa44-4882-a243-1e326fbe21db;version=1.1",
"version": "text",
"name": "text",
"author": "text",
"authored": "text",
"schema": "{\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"description\":\"Email\",\"type\":\"object\",\"properties\":{\"emailAddress\":{\"type\":\"string\",\"format\":\"email\"}},\"required\":[\"emailAddress\"],\"additionalProperties\":false}",
"proof": {}
},
"tags": [
"text"
],
"status": "DRAFT",
"createdAt": "text",
"updatedAt": "text",
"createdBy": "text",
"updatedBy": "text",
"deprecatedId": "text"
}
It should be valid string in handlebar format
did:cred-schema:MDP8AsFhHzhwUvGNuYkX7T/06e126d1-fa44-4882-a243-1e326fbe21db;version=1.1
POST /api/v1/template HTTP/1.1
Host: sunbirdrc.dev
Token: YOUR_API_KEY
Content-Type: appliation/json
Accept: */*
Content-Length: 120
{
"template": "text",
"schemaId": "did:cred-schema:MDP8AsFhHzhwUvGNuYkX7T/06e126d1-fa44-4882-a243-1e326fbe21db;version=1.1"
}
{
"template": "text",
"schemaId": "did:cred-schema:MDP8AsFhHzhwUvGNuYkX7T/06e126d1-fa44-4882-a243-1e326fbe21db;version=1.1",
"templateId": "did:cred-template:MDP8AsFhHzhwUvGNuYkX7T/06e126d1-fa44-4882-a243-1e326fbe21dc;version=1.1",
"createdAt": "text",
"updatedAt": "text",
"createdBy": "text",
"updatedBy": "text"
}
Create a new version of template
It should be valid string in handlebar format
did:cred-schema:MDP8AsFhHzhwUvGNuYkX7T/06e126d1-fa44-4882-a243-1e326fbe21db;version=1.1
PUT /api/v1/template/{id} HTTP/1.1
Host: sunbirdrc.dev
Token: YOUR_API_KEY
Content-Type: appliation/json
Accept: */*
Content-Length: 120
{
"template": "text",
"schemaId": "did:cred-schema:MDP8AsFhHzhwUvGNuYkX7T/06e126d1-fa44-4882-a243-1e326fbe21db;version=1.1"
}
{
"template": "text",
"schemaId": "did:cred-schema:MDP8AsFhHzhwUvGNuYkX7T/06e126d1-fa44-4882-a243-1e326fbe21db;version=1.1",
"templateId": "did:cred-template:MDP8AsFhHzhwUvGNuYkX7T/06e126d1-fa44-4882-a243-1e326fbe21dc;version=1.1",
"createdAt": "text",
"updatedAt": "text",
"createdBy": "text",
"updatedBy": "text"
}