Skip to content

Latest commit

 

History

History
194 lines (137 loc) · 8.66 KB

depository_api.md

File metadata and controls

194 lines (137 loc) · 8.66 KB

Depository APIs

GET /basic/nonce

Used to get current nonce of a account

Example

curl -X GET \
  http://localhost:9999/basic/currentNonce?account=xxx 

Response

{
  "nonce": "xxx"
}

GET /basic/total/hf/metadata

Used to get depository contract's metadta

Example

curl -X GET \
  http://localhost:9999/hf/metadata 

Response

{
    "content": "eyJpbmZvIjp7InRpdGxlIjoidW5kZWZpbmVkIiwidmVyc2lvbiI6ImxhdGVzdCJ9LCJjb250cmFjdHMiOnsib3JnLmJlc3RjaGFpbnMuY29tLkJhc2ljQ29udHJhY3QiOnsiaW5mbyI6eyJ0aXRsZSI6Im9yZy5iZXN0Y2hhaW5zLmNvbS5CYXNpY0NvbnRyYWN0IiwidmVyc2lvbiI6ImxhdGVzdCJ9LCJuYW1lIjoib3JnLmJlc3RjaGFpbnMuY29tLkJhc2ljQ29udHJhY3QiLCJ0cmFuc2FjdGlvbnMiOlt7InBhcmFtZXRlcnMiOlt7Im5hbWUiOiJwYXJhbTAiLCJzY2hlbWEiOnsidHlwZSI6InN0cmluZyJ9fSx7Im5hbWUiOiJwYXJhbTEiLCJzY2hlbWEiOnsidHlwZSI6Im51bWJlciIsImZvcm1hdCI6ImRvdWJsZSIsIm1heGltdW0iOjE4NDQ2NzQ0MDczNzA5NTUyMDAwLCJtaW5pbXVtIjowLCJtdWx0aXBsZU9mIjoxfX1dLCJ0YWciOlsic3VibWl0IiwiU1VCTUlUIl0sIm5hbWUiOiJDaGVjayJ9LHsicGFyYW1ldGVycyI6W3sibmFtZSI6InBhcmFtMCIsInNjaGVtYSI6eyJ0eXBlIjoic3RyaW5nIn19XSwidGFnIjpbInN1Ym1pdCIsIlNVQk1JVCJdLCJuYW1lIjoiQ3VycmVudCIsInJldHVybnMiOnsidHlwZSI6Im51bWJlciIsImZvcm1hdCI6ImRvdWJsZSIsIm1heGltdW0iOjE4NDQ2NzQ0MDczNzA5NTU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IsIml0ZW1zIjp7InR5cGUiOiJpbnRlZ2VyIiwiZm9ybWF0IjoiaW50MzIiLCJtYXhpbXVtIjoyNTUsIm1pbmltdW0iOjB9fSwic2lnbmF0dXJlIjp7InR5cGUiOiJhcnJheSIsIml0ZW1zIjp7InR5cGUiOiJpbnRlZ2VyIiwiZm9ybWF0IjoiaW50MzIiLCJtYXhpbXVtIjoyNTUsIm1pbmltdW0iOjB9fX0sInJlcXVpcmVkIjpbIm5vbmNlIiwicHVibGljS2V5Iiwic2lnbmF0dXJlIl0sImFkZGl0aW9uYWxQcm9wZXJ0aWVzIjpmYWxzZX19fX0="
}

Note: content is a base64 encoded json

GET /basic/total

Used to get total count of depositories

Example

curl -X GET \
  http://localhost:9999/basic/total

Response

{
    "total": 0
}

Get /basic/getValue

Used to get depository value

Example

We support to get depository value by its index or kid

  1. By index
curl -X GET \
  'http://localhost:9999/basic/getValue?index=1'
  1. By kid(key id)
curl -X GET \
  'http://localhost:9999/basic/getValue?kid=xxx'

Response

{
  "index": "1",
  "kid": "xxx",
  "value": "xxx"
}

POST /basic/putValue

Used to create a depository with value

Example

curl -X POST \
  http://localhost:9999/basic/putValue \
  -H 'content-type: application/json' \
  -d '{ 
 "message": "base64_encoded_string_of_message",
 "value": "xxx"
}'

Response

{
  "kid": "xxxxx"
}

POST /basic/verifyValue

Used to verify a depository with value

Example

curl -X POST \
  http://localhost:9999/basic/verifyValue \
  -H 'content-type: application/json' \
  -d '{ 
 "kid": "xxx",
  "index": "xxx",
 "value": "xxx"
}'

Response

{
  "status": "xxxxx",
  "reason": "xxx"
}

GET /basic/depositories

List depositories

curl http://localhost:9999/basic/depositories

query参数:

name description required default
from pagination N 0
size pagination N 10
startTime start time (1234), unit is second N 0
endTime end time N 0
name depository name N
contentName file name or some description N
kid depository id N
{"count":4,"data":[{"index":"25","kid":"5651d9ae0e5a834afda3fac0e1e743ff3ced5e9d","platform":"bestchains","operator":"","owner":"","blockNumber":42,"name":"abc","contentName":"file name","contentID":"some hash","contentType":"some hash","trustedTimestamp":"1682406287"}]}

GET /basic/depositories/:kid

Get depository by kid

curl http://localhost:9999/basic/depositories/5651d9ae0e5a834afda3fac0e1e743ff3ced5e9d
{"index":"22","kid":"28fd8a24340220857c9857dbeb3f365e505951ca","platform":"bestchains","operator":"","owner":"","blockNumber":37,"name":"dep1","contentName":"","contentID":"lk7234jjsdfsf","contentType":"lk7234jjsdfsf","trustedTimestamp":"1682405989"}

GET /basic/depositories/certificate/:kid

Request:

Get depository certificate by kid

curl -XGET http://localhost:9999/basic/depositories/certificate/02e853e0f68566e62fddd9c4e014db65b7f315d9

Response:

A pdf will be downloaded directly from browser with filename 02e853e0f68566e62fddd9c4e014db65b7f315d9.pdf({kid}.pdf):

  • Content-Type: application/octet-stream
  • Content-Disposition: attachment; filename=02e853e0f68566e62fddd9c4e014db65b7f315d9.pdf