mirror of
https://github.com/PeernetOfficial/Cmd.git
synced 2026-07-17 02:47:52 +01:00
New API function /blockchain/self/list/file to list all files in the blockchain
This commit is contained in:
42
API.md
42
API.md
@@ -43,6 +43,7 @@ These are the functions provided by the API:
|
||||
/blockchain/self/append Append a block to the blockchain
|
||||
/blockchain/self/read Read a block of the blockchain
|
||||
/blockchain/self/add/file Add file to the blockchain
|
||||
/blockchain/self/list/file List all files stored on the blockchain
|
||||
```
|
||||
|
||||
The `/share` functions are providing high-level functionality to work with files. The `/blockchain` functions provide low-level functionality which is typically not needed.
|
||||
@@ -201,3 +202,44 @@ type apiBlockchainBlockStatus struct {
|
||||
Height uint64 `json:"height"` // New height of the blockchain (number of blocks).
|
||||
}
|
||||
```
|
||||
|
||||
Example POST request data to `http://127.0.0.1:112/blockchain/self/add/file`:
|
||||
|
||||
```json
|
||||
{
|
||||
"files": [{
|
||||
"hash": "aFad3zRACbk44dsOw5sVGxYmz+Rqh8ORDcGJNqIz+Ss=",
|
||||
"type": 1,
|
||||
"format": 10,
|
||||
"size": 4,
|
||||
"name": "Test.txt",
|
||||
"directory": "sample directory/sub folder"
|
||||
}]
|
||||
}
|
||||
```
|
||||
|
||||
## Blockchain List Files
|
||||
|
||||
This lists all files stored on the blockchain.
|
||||
|
||||
```
|
||||
Request: GET /blockchain/self/list/file
|
||||
|
||||
Response: 200 with JSON structure apiBlockAddFiles
|
||||
```
|
||||
|
||||
Example output:
|
||||
|
||||
```json
|
||||
{
|
||||
"files": [{
|
||||
"hash": "aFad3zRACbk44dsOw5sVGxYmz+Rqh8ORDcGJNqIz+Ss=",
|
||||
"type": 1,
|
||||
"format": 10,
|
||||
"size": 4,
|
||||
"directory": "sample directory/sub folder",
|
||||
"name": "Test.txt"
|
||||
}],
|
||||
"status": 0
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user