天河链数字藏品-开放 API 文档
  1. v2
天河链数字藏品-开放 API 文档
  • v2
    • 用户链上身份注册
      POST
    • 用户链上身份秘钥修改
      POST
    • 用户链上身份查询
      POST
    • 数字商品发行
      POST
    • 数字商品交易
      POST
    • 交易结果查询
      POST
    • 销毁数字商品
      POST
    • 数字商品元数据上链存储
      POST
    • 根据交易哈希查询 TokenID
      GET
    • NFR 所属者链上地址查询
      POST
    • NFR 所属者判断
      POST
    • 补全NFR图片接口
      POST
    • 同步第三方 URI
      POST
    • 补全接口图片状态查询接口
      POST
    • 根据交易的操作Id批量查询 TokenID
      POST
  1. v2

数字商品交易

测试环境
https://test.api.tichain.tianhecloud.com
测试环境
https://test.api.tichain.tianhecloud.com
POST
/api/v2/nfr/transfer
基于数字商品进行数字资产交易,必须是持有该数字商品 TokenId的用户ID,并指定Key才能执行成功,同时请确保userId对应的区块链地址和from是同一个地址。
10分钟内,相同参数多次调用该接口,结果不变。

请求参数

Body 参数application/json
appId
string 
商家编号
必需
appKey
string 
商家密钥
必需
userId
string 
用户ID
必需
userKey
string 
用户秘钥
必需
contractAddress
string 
合约地址
必需
字符长度为 42
tokenId
integer 
token编号
必需
非负整数
from
string 
发起方公钥地址
必需
字符长度为 42
to
string 
接收方公钥地址
必需
字符长度为 42
示例
{
    "appId": "{{appId}}",
    "appKey": "{{appKey}}",
    "userId": "000000-0101-TEST01",
    "userKey": "123456",
    "contractAddress": "0xfc3b1867cfa0c33af4634de4fc7fabab8bf4d3b6",
    "tokenId": 1,
    "from": "0x96b8f49453427659ed97abfea156d916ef9fb2e3",
    "to": "0x073547087c4ca0ce9b401e4a4745bd435442548a"
}

示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://test.api.tichain.tianhecloud.com/api/v2/nfr/transfer' \
--header 'Content-Type: application/json' \
--data-raw '{
    "appId": "",
    "appKey": "",
    "userId": "000000-0101-TEST01",
    "userKey": "123456",
    "contractAddress": "0xfc3b1867cfa0c33af4634de4fc7fabab8bf4d3b6",
    "tokenId": 1,
    "from": "0x96b8f49453427659ed97abfea156d916ef9fb2e3",
    "to": "0x073547087c4ca0ce9b401e4a4745bd435442548a"
}'

返回响应

🟢200成功
application/json
Body
code
integer 
消息码
必需
message
string 
消息
必需
data
object 
必需
transactionHash
string 
交易哈希
必需
示例
{
    "code": 0,
    "message": "success",
    "data": {
        "transactionHash": "0x24f43315beb48392d61e16139acd6ce131402eff9f166d6293c3d72aaf6e0255"
    }
}
修改于 2023-03-01 09:43:13
上一页
数字商品发行
下一页
交易结果查询
Built with