Skip to main content

writetexttofile

Description:

Add text content directly to moibit, instead of constructing the file out of text.

Request

https://api.moinet.io/moibit/v1/writetexttofile

Request type - POST

Headers#

Header KeyHeader ValueOptional
nonce<developer_nonce> No
signature<signature gotten after signing developer_nonce by developer> No
developerKeypublic id of the developerNo
networkIDID of the network the file want to be written toNo
appIDID of the app the file want to be written to Yes
enduser_nonce<enduser nonce>No if enduser has moi_id
enduser_signature<signature gotten after signing enduser_nonce by enduser>No if enduser has moi_id
enduserIDId of the enduser if end-user doesn't have moi_idYes

Content-Type: application/json

Parameters#

Param KeyParam TypeDescriptionOptional
fileNameStringFile name you willing to reference the content.Yes
textStringText content to add No
keepPreviousBooleanEnsures that the previous version of the file was still maintained along with new file. Default:false Yes
createFoldersBooleanCreate folders as needed. Otherwise, if a path specified in fileName does not exist, the operation will fail. Default:true Yes
replicationIntegerNumber of replicas the file should have. Default: Min_RF of networkYes
encryptionTypeInteger-1 : No Encryption
0 : Default Network Encryption
1 : Developer Key Encryption
2 : Enduser Key Encryption
3 : Custom Key Encryption
4 : MES
Default: encryptionType of app, 0 if default-App
Yes

Write to Indus Testnet#

Just set isProvenance flag to true in your /writefile payload to write the same file/proof into MOI Indus testnet

isProvenanceBooleanSet this flag to true, if you want your file/proof also to be recorded in MOI Indus TestnetYes

Response Array#

FieldDescription
versionversion of the file
hashContent identifier of the file
filesizeSize of the file uploaded
replication Number of replicas the file have
encryptionType Encryption type of file
lastUpdatedDate of the file when uploaded
directory Parent directory of the file being uploaded
path Absolute path of the file in system
isDir Is a directory or a file
recoveryTime Time duration till when one can recover this file once deleted
nodeAddressID of the node that processed this file

Sample Response#

{
"meta": {
"code": 200,
"requestId": "6a892588-7d62-4704-bdaa-1bd740ea37d4",
"message": "file uploaded successfully"
},
"data": [
"[{\"active\":true,\"enable\":true,\"version\":1,\"hash\":\"QmNuhFamMa6qSagg2Dfd34Nu3H1BJrRnrd2JXpCwAZpBFV\",\"filesize\":0,\"replication\":2,\"filetype\":\"1\",\"encryptionType\":0,\"encryptionKey\":\"69e612026d4fb9973b3eac5ca04ce7d0b6196ace0627f2345a2e0b84eed5fb8c\",\"lastUpdated\":\"2021-05-16T08:30:44.523296339+02:00\",\"directory\":\"/\",\"isDir\":false,\"path\":\"/testing.txt\",\"recoveryTime\":0,\"permanentDelete\":false,\"nodeAddress\":\"0x5cE29EC82c8BBbA32006dE4e0a2dCA44EDC9097b\",\"appDeleted\":false,\"userDeleted\":false}]"
]
}