> For the complete documentation index, see [llms.txt](https://divoc.digit.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://divoc.digit.org/platform/divocs-verifiable-certificate-features-3.5/how-to-manage-schemas.md).

# How to Manage Schemas?

## Purpose

The purpose of this document is to demonstrate how to manage a schema.&#x20;

## Update context

* Request method: PUT
* Request URL: {{baseUrl}}/vc-management/v1/context/osid
* Sample URL: {{baseUrl}}/vc-management/v1/context/603a895d-3f0f-468c-943a-e09e5ed5cbcc
* Request body
* Key: Files
* Value: ContextFile.json( should be in json format)

### Response Json

```
{
    "message": {
        "id": "sunbird-rc.registry.update",
        "ver": "1.0",
        "ets": 1674746574685,
        "params": {
            "resmsgid": "",
            "msgid": "d56c646d-8705-48fe-9b89-13d64007697a",
            "err": "",
            "status": "SUCCESSFUL",
            "errmsg": ""
        },
        "responseCode": "OK"
    },
    "response": "Context is Updated successfully"
}
```

## Update Template

* Request method: PUT
* RequestURL:{{baseUrl}}/vc-management/v1/schema/:schemaId/updateTemplate?templateKey=html2
* Request body
* Key: Files
* Parameters: Query parameters
* Key: Value
* Template key: html2 path parameters
* Key: Value
* Schema Id:804de269-c542-4707-9817-5780d2e8c9eb
* Value: vcTempHealthcareUpdateds\_HN.html( should be in html format)

### Response Json

```
{"message":"Successfully updated Schema",
"templateUpdateResponse":{
"id":"sunbird-rc.registry.update",
"ver":"1.0","ets":1674823685025,
"params":{
"resmsgid":"",
"msgid":"3fab58a0-84f4-4c9a-ad3e-3fe1c15f30e8",
"err":"",
"status":"SUCCESSFUL",
"errmsg":""
},
"responseCode":"OK"
}
}
```

## Update Template URL

* Request method: PUT
* Request URL: {{baseUrl}}/vc-management/v1/schema/:schemaId/updateTemplateUrl
* Request body
* Key: Files
* Parameters: query parameters
* Key: Value
* Template Key: html2 path parameters
* Key: Value
* Schema ID: 804de269-c542-4707-9817-5780d2e8c9eb

### Request Body

```
{
    "html4": "minio://Tenant/f28d95e7-17ea-4f93-b457-195d133fbc27/templates/documents/443cc5d0-b2ee-4928-b77b-ccb2c72a7908-vcTempHealthcareUpdated.html"
}
```

### Response Json

```
{
"message":"Successfully updated Schema with template URLs",
"templateUpdateResponse":{
"id":"sunbird-rc.registry.update",
"ver":"1.0","ets":1674824286711,
"params":{
"resmsgid":"",
"msgid":"4f0ae513-d950-48c0-a020-d31fb984916c",
"err":"",
"status":"SUCCESSFUL",
"errmsg":""
},
"responseCode":"OK"
}
}
```

## Get Context

### Specifications

* Request method: GET
* Request URL: {{baseUrl}}/vc-management/v1/context/osid
* SampleUrl:{{baseUrl}}/vc-management/v1/context/1-a6bd2f3b-43d4-406e-a265-917ff6d5199f
* Headers: Content-Type:   application/json Accept application/json
* Authorisation: Bearer \<access-token>

### Response Json

```
{
    "@context": {
        "@version": 1.1,
        "@protected": true,
        "id": "@id",
        "type": "@type",
        "schema": "https://schema.org/",
        "hp": "https://council.gov.in/credentials/healthProfessional/v1",
        "ProofOfHealthProfessionalCredential": {
            "@id": "schema:ProofOfHealthProfessionalCredential",
            "@context": {
                "@version": 1.1,
                "@protected": true,
                "nonTransferable": "vac:nonTransferable"
            }
        },
        "Person": {
            "@id": "schema:Person",
            "@context": {
                "@version": 1.1,
                "@protected": true,
                "registrationId": "schema:id",
                "name": "schema:name",
                "dob": "schema:date",
                "gender": "schema:gender"
            }
        },
        "HealthProfessional_1": {
            "@id": "hp:HealthProfessional",
            "@context": {
                "@version": 1.1,
                "@protected": true,
                "certificateId": "schema:id",
                "registrationCouncil": "schema:Text",
                "latestQualification": "schema:Text",
                "university": "schema:Text",
                "registrationDate": "schema:date",
                "systemOfMedicine": "schema:Text",
                "registrationExpiry": "schema:date",
                "degreeYear": "schema:Text"
            }
        }
    }  }
```

## Get All Schema’s

* Request method: GET
* Request URL: {{baseUrl}}/vc-management/v1/schema/
* Authorisation needed

### Response Json

```
{
    "schemas": [
        {
            "schema": "{\"$schema\":\"http://json-schema.org/draft-07/schema\",\"type\":\"object\",\"properties\":{\"HealthCertificate\":{\"$ref\":\"#/definitions/HealthCertificate\"}},\"required\":[\"HealthCertificate\"],\"title\":\"HealthCertificate\",\"definitions\":{\"HealthCertificate\":{\"type\":\"object\",\"title\":\"\",\"required\":[\"name\",\"adfj\",\"issuanceDate\",\"issuer\",\"certificateId\"],\"properties\":{\"name\":{\"type\":\"string\",\"description\":\"NA\"},\"adfj\":{\"type\":\"integer\",\"description\":\"sjn\"},\"issuanceDate\":{\"type\":\"string\",\"description\":\"Date certificate issued on\"},\"issuer\":{\"type\":\"string\",\"description\":\"Name of the issuing authority\"},\"certificateId\":{\"type\":\"string\",\"description\":\"The unique Certificate ID\"},\"validFrom\":{\"type\":\"string\",\"description\":\"The date from which the credential is valid from\"},\"validTill\":{\"type\":\"string\",\"description\":\"The date until which the credential is valid to\"},\"degree\":{\"type\":\"string\",\"description\":\"NA\"}}}},\"_osConfig\":{\"uniqueIndexFields\":[\"certificateId\",\"degree\"],\"indexFields\":[\"name\",\"certificateId\"],\"ownershipAttributes\":[],\"roles\":[],\"inviteRoles\":[],\"credentialTemplate\":{\"@context\":[\"https://www.w3.org/2018/credentials/v1\",\"http://vc-management-service:7655/vc-management/v1/context/40c2078c-bc19-494a-8ce2-977804aa32c0\",\"https://www.w3.org/2018/credentials/v1\"],\"type\":[\"VerifiableCredential\",\"ProofOfHealthCertificateCredential\"],\"credentialSubject\":{\"type\":\"Person\"},\"issuer\":\"{{issuer}}\",\"issuanceDate\":\"{{issuanceDate}}\",\"evidence\":{\"type\":\"HealthCertificate\",\"name\":\"{{name}}\",\"adfj\":\"{{adfj}}\",\"issuanceDate\":\"{{issuanceDate}}\",\"issuer\":\"{{issuer}}\",\"certificateId\":\"{{certificateId}}\",\"validFrom\":\"{{validFrom}}\",\"validTill\":\"{{validTill}}\",\"degree\":\"{{degree}}\"},\"nonTransferable\":\"true\"},\"certificateTemplates\":{\"default\":\"https://gist.githubusercontent.com/saiprakash-v/c5aa3d97de95806669b4ea26ec54bd55/raw/9f38b9c6d3e458e7facb658dbb3cb661af9664fb/templateWithOnlyQR.html\",\"html\":\"minio://Tenant/f28d95e7-17ea-4f93-b457-195d133fbc27/templates/documents/1c7060c8-e69f-4c93-a486-e865929db133-template (2).html\"}}}",
            "osUpdatedAt": "2023-01-26T14:55:19.662Z",
            "osCreatedAt": "2023-01-05T11:16:41.815Z",
            "osUpdatedBy": "5a4e0234-c5fe-497d-a980-8c41664eff82",
            "name": "HealthCertificate",
            "osCreatedBy": "5a4e0234-c5fe-497d-a980-8c41664eff82",
            "osid": "1-7597a289-548a-4f27-9602-5840a1401413",
            "osOwner": [
                "5a4e0234-c5fe-497d-a980-8c41664eff82"
            ],
            "status": "DRAFT"
        },
        {
            "schema": "{\"$schema\":\"http://json-schema.org/draft-07/schema\",\"type\":\"object\",\"properties\":{\"testing\":{\"$ref\":\"#/definitions/testing\"}},\"required\":[\"testing\"],\"title\":\"testing\",\"definitions\":{\"testing\":{\"type\":\"object\",\"title\":\"testing\",\"required\":[\"issuanceDate\",\"issuer\",\"certificateId\",\"name\",\"degree\"],\"properties\":{\"issuanceDate\":{\"type\":\"string\",\"description\":\"Date certificate issued on\"},\"issuer\":{\"type\":\"string\",\"description\":\"Name of the issuing authority\"},\"certificateId\":{\"type\":\"string\",\"description\":\"The unique Certificate ID\"},\"validFrom\":{\"type\":\"string\",\"description\":\"The date from which the credential is valid from\"},\"validTill\":{\"type\":\"string\",\"description\":\"The date until which the credential is valid to\"},\"name\":{\"type\":\"string\",\"description\":\"\"},\"degree\":{\"type\":\"string\",\"description\":\"\"}}}},\"_osConfig\":{\"uniqueIndexFields\":[\"certificateId\"],\"indexFields\":[\"certificateId\"],\"ownershipAttributes\":[],\"roles\":[],\"inviteRoles\":[],\"credentialTemplate\":{\"@context\":[\"https://www.w3.org/2018/credentials/v1\",\"http://vc-management-service:7655/vc-management/v1/context/54d2dea8-a51d-4d82-9c57-9ad860d262a2\",\"https://www.w3.org/2018/credentials/v1\"],\"type\":[\"VerifiableCredential\",\"ProofOftestingCredential\"],\"credentialSubject\":{\"type\":\"Person\",\"name\":\"{{name}}\"},\"issuer\":\"{{issuer}}\",\"issuanceDate\":\"{{issuanceDate}}\",\"evidence\":{\"type\":\"testing\",\"issuanceDate\":\"{{issuanceDate}}\",\"issuer\":\"{{issuer}}\",\"certificateId\":\"{{certificateId}}\",\"validFrom\":\"{{validFrom}}\",\"validTill\":\"{{validTill}}\",\"degree\":\"{{degree}}\"},\"nonTransferable\":\"true\"},\"certificateTemplates\":{\"default\":\"https://gist.githubusercontent.com/saiprakash-v/c5aa3d97de95806669b4ea26ec54bd55/raw/9f38b9c6d3e458e7facb658dbb3cb661af9664fb/templateWithOnlyQR.html\"}}}",
            "osUpdatedAt": "2023-01-05T10:03:30.394Z",
            "osCreatedAt": "2023-01-05T10:03:12.032Z",
            "osUpdatedBy": "5a4e0234-c5fe-497d-a980-8c41664eff82",
            "name": "testing",
            "osCreatedBy": "5a4e0234-c5fe-497d-a980-8c41664eff82",
            "osid": "1-d5a650af-92e9-47d5-a92f-637e79eaf3b0",
            "osOwner": [
                "5a4e0234-c5fe-497d-a980-8c41664eff82"
            ],
            "status": "PUBLISHED"
        }
    ]
}
```

## Delete Context

* Request method: Delete
* Request URL: {{baseUrl}}/vc-management/v1/context/osId
* SampleURL:{{baseUrl}}/vc-management/v1/context/09b4e155-cf13-4082-b0ec-b4128e21e2c5
* Authorisation needed

### Response Json

```
{
    "message": "Deleted Context",
    "Response": {
        "id": "sunbird-rc.registry.delete",
        "ver": "1.0",
        "ets": 1674747157283,
        "params": {
            "resmsgid": "",
            "msgid": "7fff708a-26dc-4b7b-afe4-4082f5b5c207",
            "err": "",
            "status": "SUCCESSFUL",
            "errmsg": ""
        },
        "responseCode": "OK"
    }
}
```

[![Creative Commons License](https://i.creativecommons.org/l/by/4.0/80x15.png)](http://creativecommons.org/licenses/by/4.0/)*All content on this page by* [*eGov Foundation*](https://egov.org.in/) *is licensed under a* [*Creative Commons Attribution 4.0 International License*](http://creativecommons.org/licenses/by/4.0/)*.*


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://divoc.digit.org/platform/divocs-verifiable-certificate-features-3.5/how-to-manage-schemas.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
