Create DID-Linked Resource
Create a DID-Linked Resource associated with a cheqd DID over REST API
Using the
/resource/create
API, users are able to create custom DID-Linked Resources, including:- 1.Schemas
- 2.Credential Definitions
- 3.Trust Registries
- 4.Logos associated with DIDs
- 5.Governance files
Make sure you have set up your account with Credential Service and are logged in, using our guide below:
Before you can create a DID-Linked Resource, you need to create a "parent" DID which is used to link the Resource on-ledger. Use the API in the page below to create a DID:
DID-Linked Resources can be any type of file or content that is below ~45kb in size.
For the purpose of an example, lets use an AnonCreds schema (JSON file) as the resource:
{
"name": "degreeSchema",
"version": "1.5.7",
"attrNames": ["name", "age", "degree", "grade"]
}
Save this file locally and call it something like
resource.json.
Prepare a file with resource and encode it into
base64, base64url
or hex
. On Unix systems, you can use the following command input:$ base64 -w 0 resource.json
<path-to-the-resource-file>
Expected output:
$ base64 -w 0 resource.json
SGVsbG8sIHdvcmxk
Resources are grouped by having identical names and types. This means if you want to create a new version of the same Resource, you will need to specify the same name and type in the following request.
post
/resource/create/{did}
Create a DID-Linked Resource.
This endpoint creates a DID-Linked Resource. As input, it can take the DID identifier and the resource parameters via a form, or the fully-assembled resource itself.
Parameters
Path
did*
string
DID identifier to link the resource to.
Body
Example
Schema
{
"data": "SGVsbG8gV29ybGQ=",
"encoding": "base64url",
"name": "ResourceName",
"type": "TextDocument"
}
application/x-www-form-urlencoded
Responses
200: OK
The request was successful.
400: Bad Request
A problem with the input fields has occurred. Additional state information plus metadata may be available in the response body.
401: Unauthorized
Access token is missing or invalid
500: Internal Server Error
An internal error has occurred. Additional state information plus metadata may be available in the response body.