returns ddo state
| name | type | required | description |
|---|---|---|---|
| did | object | document id or did | |
| chainId | object | chain id of network on which document is provided | |
| nft | object | one or more field names that should be queried against |
123
returns search result for query
| name | type | required | description |
|---|---|---|---|
| q | object | v | text to search for in database |
| query_by | object | v | one or more field names that should be queried against |
{
"q": "0x123",
"query_by": "nftAddress"
}[{
"facet_counts": [],
"found": 1,
"out_of": 1,
"page": 1,
"request_params": {
"collection_name": "ddo",
"per_page": 10,
"q": "0x123"
},
"search_time_ms": 1,
"hits": [
{
"highlights": [
{
"field": "nftAddress",
"snippet": "<mark>0x123</mark>",
"matched_tokens": ["0x123"]
}
],
"document": {
"@context": ["https://w3id.org/did/v1"],
"id": "did:op:ACce67694eD2848dd683c651Dab7Af823b7dd123",
"version": "4.1.0",
"chainId": 1,
"nftAddress": "0x123",
...
},
"text_match": 130916
}
]
}]
returns metadata of document by id
{
"created": "2020-11-15T12:27:48Z",
"updated": "2021-05-17T21:58:02Z",
"description": "Sample description",
"name": "Sample asset",
"type": "dataset",
"author": "OPF",
"license": "https://market.oceanprotocol.com/terms"
}
returns document by id
{
"@context": ["https://w3id.org/did/v1"],
"id": "did:op:ACce67694eD2848dd683c651Dab7Af823b7dd123",
"version": "4.1.0",
"chainId": 1,
"nftAddress": "0x123",
...
}
returns stored nonce for an address
| name | type | required | description |
|---|---|---|---|
| userAddress | string | v | address |
123
returns amount of tokens to transfer to the provider account
| name | type | required | description |
|---|---|---|---|
| documentId | string | v | document id or did |
| serviceId | string | v | id of the service the datatoken is attached to |
| consumerAddress | string | v | consumer address |
{
"datatoken": "0x123",
"nonce": "123",
"providerFee": {
providerFeeAddress: "0x123",
providerFeeToken: "0x123",
providerFeeAmount: 123,
providerData: "0x123",
v: 123,
r: "0x123",
s: "0x123",
validUntil: 123
}
}
returns encrypted blob
string
0x123
returns decrypted document
| name | type | required | description |
|---|---|---|---|
| decrypterAddress | string | v | decrypter address |
| chainId | number | v | chain id of network on which document is provided |
| transactionId | string | tx id of encrypted document | |
| dataNftAddress | string | address of nft token | |
| encryptedDocument | string | encrypted document | |
| flags | number | metadata flags if DDO is ECIES encrypted or lzma compressed | |
| documentHash | string | hash based on sha256 of asset | |
| nonce | string | v | is required to verify a request paired with a signature |
| signature | string | v | signed message based on transactionId + dataNftAddress + decrypterAddress + chainId + nonce |
{
"decrypterAddress": "0x123",
"chainId": 123,
"transactionId": "0x123",
"dataNftAddress": "0x123",
"encryptedDocument": "0x123",
"flags": 1,
"documentHash": "0x123",
"nonce": "123",
"signature": "0x123"
}{
"@context": ["https://w3id.org/did/v1"],
"id": "did:op:ACce67694eD2848dd683c651Dab7Af823b7dd123",
"version": "4.1.0",
"chainId": 1,
"nftAddress": "0x123",
...
}
returns file information
| name | type | required | description |
|---|---|---|---|
| type | string | type of storage url or arweave or ipfs |
|
| did | string | document id or did | |
| serviceId | number | service id of services list | |
| fileIndex | number | file index in files array | |
| file | object | file data | |
| checksum | number | index in transaction events list |
{
"type": "123",
"did": "did:op:123",
"serviceId": 123,
"fileIndex": 123,
"file": 123,
"checksum": 123
}[
{
valid: true
contentLength: "123"
contentType: "123"
name: "123"
type: "url or arweave or ipfs"
}
]
returns a file stream of the requested file
| name | type | required | description |
|---|---|---|---|
| fileIndex | number | v | file index in the list of document files |
| documentId | string | v | document id or did |
| serviceId | string | v | service id of array of services defining access to the asset |
| transferTxId | string | v | tx id of transaction for approval of datatokens transfer given to the provider's account |
| nonce | string | v | is required to verify a request paired with a signature |
| consumerAddress | string | v | consumer address |
| signature | string | v | signed message based on did + nonce |
| aes_encrypted_key | string | encrypted key for cipher to decrypt file |
byte array
returns log by id
{
"timestamp": "123",
"level": "123",
"message": "123",
"moduleName": "123",
"meta": "123",
}
returns list of logs
| name | type | required | description |
|---|---|---|---|
| startTime | string | filter logs from date | |
| endTime | string | filter logs to date | |
| maxLogs | string | logs per page | |
| moduleName | string | filter logs by module name | |
| level | string | filter logs by level |
[
{
"id": "123",
"timestamp": "123",
"level": "123",
"message": "123",
"moduleName": "123",
"meta": "123",
}
]
returns an empty if command is valid
| name | type | required | description |
|---|---|---|---|
| command | string | v | command name |
| ... | any | any other command parameters |
{
"command": "echo",
"...": "..."
}returns empty if advertising did around peers was successful
| name | type | required | description |
|---|---|---|---|
| did | string | v | document id or did |
returns P2P peer
| name | type | required | description |
|---|---|---|---|
| peerId | string | v | peer id |
{
"id": "PeerId",
"addresses": [{ multiaddr: "123", isCertified: true }],
"protocols": ["123", "123", "123"],
"metadata": {},
"tags": {},
"publicKey": "0x123"
}
returns list of all P2P peers
[
{
"id": "PeerId",
"addresses": [{ multiaddr: "123", isCertified: true }],
"protocols": ["123", "123", "123"],
"metadata": {},
"tags": {}
}
]
returns list of ocean node peers
["PeerId", "PeerId", "PeerId"]
returns an empty object if it is valid otherwise an array with error
| name | type | required | description |
|---|---|---|---|
| command | string | v | command name |
| node | string | if not present it means current node | |
| id | string | v | document id or did |
| chainId | number | v | chain id of network on which document is provided |
| nftAddress | string | v | address of nft token |
{
"command": "validateDDO",
"node": "PeerId",
"id": "did:op:123",
"chainId": 123,
"nftAddress": "0x123"
}returns file information
| name | type | required | description |
|---|---|---|---|
| command | string | v | command name |
| node | string | if not present it means current node | |
| type | string | type of storage url or arweave or ipfs |
|
| did | string | document id or did | |
| serviceId | number | service id of services list | |
| fileIndex | number | file index in files array | |
| file | object | file data | |
| checksum | number | index in transaction events list |
{
"command": "fileInfo",
"node": "PeerId",
"type": "123",
"did": "did:op:123",
"serviceId": 123,
"fileIndex": 123,
"file": 123,
"checksum": 123
}[
{
valid: true
contentLength: "123"
contentType: "123"
name: "123"
type: "url or arweave or ipfs"
}
]
returns a message about successful addition to the reindexing queue
| name | type | required | description |
|---|---|---|---|
| command | string | v | command name |
| node | string | if not present it means current node | |
| txId | string | v | id of transaction for reindexing |
| chainId | number | v | chain id of network on which transaction is provided |
| eventIndex | number | index in transaction events list |
{
"command": "reIndex",
"node": "PeerId",
"txId": "0x123",
"chainId": 123,
"eventIndex": 123
}Added to reindex queue successfully
returns calculated provider fees for DDO with service id
| name | type | required | description |
|---|---|---|---|
| command | string | v | command name |
| node | string | if not present it means current node | |
| ddo | object | v | document object |
| serviceId | string | v | service id of services list |
{
"command": "getFees",
"node": "PeerId",
"ddo": {
"@context": ["https://w3id.org/did/v1"],
"id": "did:op:ACce67694eD2848dd683c651Dab7Af823b7dd123",
"version": "4.1.0",
"chainId": 1,
"nftAddress": "0x123",
"...": "..."
},
"serviceId": "123"
}[
{
providerFeeAddress: "0x123",
providerFeeToken: "0x123",
providerFeeAmount: 123,
providerData: "0x123",
v: 123,
r: "0x123",
s: "0x123",
validUntil: 123,
}
]
returns list of providers from which ddo can be obtained
| name | type | required | description |
|---|---|---|---|
| command | string | v | command name |
| node | string | if not present it means current node | |
| id | string | v | document id or did |
{
"command": "findDDO",
"node": "PeerId",
"id": "did:op:123"
}[
{
provider: "PeerId",
id: "did:op:123"
lastUpdateTx: "123",
lastUpdateTime: "123",
}
]
returns status of node
| name | type | required | description |
|---|---|---|---|
| command | string | v | command name |
| node | string | if not present it means current node |
{
"command": "status",
"node": "PeerId"
}{
"id": "PeerId",
"publicKey": "0x123",
"address": "0x123",
"version": "123",
"http": true,
"p2p": true,
"provider": [],
"indexer": [],
"supportedStorage": {
"ipfs": true
"arwave": true
"url": true
},
"uptime": 123,
"platform": {
"cpus": "123",
"freemem": 123,
"totalmem": 123,
"loadavg": [123],
"arch": "123",
"machine": "123",
"platform": "123",
"release": "123",
"osType": "123",
"osVersion": "123",
"node": "123"
}
}
returns search result for query
| name | type | required | description |
|---|---|---|---|
| command | string | v | command name |
| node | string | if not present it means current node | |
| query | object | v | query parameters |
| query.q | object | v | text to search for in database |
| query.query_by | object | v | one or more field names that should be queried against |
{
"command": "query",
"node": "PeerId",
"query": {
"q": "0x123",
"query_by": "nftAddress"
}
}[{
"facet_counts": [],
"found": 1,
"out_of": 1,
"page": 1,
"request_params": {
"collection_name": "ddo",
"per_page": 10,
"q": "0x123"
},
"search_time_ms": 1,
"hits": [
{
"highlights": [
{
"field": "nftAddress",
"snippet": "<mark>0x123</mark>",
"matched_tokens": ["0x123"]
}
],
"document": {
"@context": ["https://w3id.org/did/v1"],
"id": "did:op:ACce67694eD2848dd683c651Dab7Af823b7dd123",
"version": "4.1.0",
"chainId": 1,
"nftAddress": "0x123",
...
},
"text_match": 130916
}
]
}]
returns document by id
| name | type | required | description |
|---|---|---|---|
| command | string | v | command name |
| node | string | if not present it means current node | |
| id | string | v | document id or did |
{
"command": "getDDO",
"node": "PeerId",
"id": "did:op:123"
}{
"@context": ["https://w3id.org/did/v1"],
"id": "did:op:ACce67694eD2848dd683c651Dab7Af823b7dd123",
"version": "4.1.0",
"chainId": 1,
"nftAddress": "0x123",
...
}
returns encrypted blob
| name | type | required | description |
|---|---|---|---|
| command | string | v | command name |
| node | string | if not present it means current node | |
| blob | string | v | blob data |
| encoding | string | v | data encoding string or base58 |
| encryptionType | string | v | encrypt method AES or ECIES |
{
"command": "encrypt",
"node": "PeerId",
"blob": "123",
"encoding": "0x123",
"encryptionType": "0x123"
}0x123
returns stored nonce for an address
| name | type | required | description |
|---|---|---|---|
| command | string | v | command name |
| node | string | if not present it means current node | |
| address | string | v | consumer address |
{
"command": "nonce",
"node": "PeerId",
"address": "0x123"
}123
returns decrypted document
| name | type | required | description |
|---|---|---|---|
| command | string | v | command name |
| node | string | if not present it means current node | |
| decrypterAddress | string | v | decrypter address |
| chainId | number | v | chain id of network on which document is provided |
| transactionId | string | tx id of encrypted document | |
| dataNftAddress | string | address of nft token | |
| encryptedDocument | string | encrypted document | |
| flags | number | metadata flags if DDO is ECIES encrypted or lzma compressed | |
| documentHash | string | hash based on sha256 of asset | |
| nonce | string | v | is required to verify a request paired with a signature |
| signature | string | v | signed message based on transactionId + dataNftAddress + decrypterAddress + chainId + nonce |
{
"command": "decryptDDO",
"node": "PeerId",
"decrypterAddress": "0x123",
"chainId": 123,
"transactionId": "0x123",
"dataNftAddress": "0x123",
"encryptedDocument": "0x123",
"flags": 1,
"documentHash": "0x123",
"nonce": "123",
"signature": "0x123"
}{
"@context": ["https://w3id.org/did/v1"],
"id": "did:op:ACce67694eD2848dd683c651Dab7Af823b7dd123",
"version": "4.1.0",
"chainId": 1,
"nftAddress": "0x123",
...
}
returns a file stream of the requested file
| name | type | required | description |
|---|---|---|---|
| command | string | v | command name |
| node | string | if not present it means current node | |
| fileIndex | number | v | file index in the list of document files |
| documentId | string | v | document id or did |
| serviceId | string | v | service id of array of services defining access to the asset |
| transferTxId | string | v | tx id of transaction for approval of datatokens transfer given to the provider's account |
| nonce | string | v | is required to verify a request paired with a signature |
| consumerAddress | string | v | consumer address |
| signature | string | v | signed message based on did + nonce |
| aes_encrypted_key | string | encrypted key for cipher to decrypt file |
{
"command": "download",
"node": "PeerId",
"fileIndex": 0,
"documentId": "did:op:123",
"serviceId": "0",
"transferTxId": "0x123",
"nonce": "123",
"consumerAddress": "0x123",
"signature": "0x123",
"aes_encrypted_key": "0x123"
}byte array
returns OK
| name | type | required | description |
|---|---|---|---|
| command | string | v | command name |
| node | string | if not present it means current node |
{
"command": "echo",
"node": "PeerId"
}OK
returns the current indexing queue, as an array of objects
{
queue: []
}