Skip to main content

writefiles

Description:

Add multiple files or directory to moibit

Request

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

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_id Yes

Content-Type: multipart/form-data

Parameters#

Param KeyParam TypeDescriptionOptional
fileNameStringFile name or path (default: filename in file header)Yes
fileArray of Blobsmultiple files or directory of any depthNo
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 or 0 if default-App
Yes

Response Array#

FieldDescription
versionversion of the file
hashContent identifier of the file
filesizeSize of the file uploaded
replication Number of replicas
encryptionType Encryption type of file
lastUpdatedDate and time when uploaded
directory Parent directory of the file being uploaded
path Absolute path of the file in system
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": "63f6293b-4960-458a-888c-b203298564cd",
"message": "file(s) uploaded successfully"
},
"data": [
[
"[{\"active\":true,\"enable\":true,\"version\":1,\"hash\":\"QmWEtthxxfZjEYdGUuguvKwGBWi7k8jPUrc6UkJ4k199zH\",\"filesize\":27,\"replication\":1,\"filetype\":\"\",\"encryptionType\":1,\"encryptionKey\":\"bc6f8aae9d628bc1b8eb8947f2fd1a87e5083886b2073cf700d7a9a5dc008dab\",\"lastUpdated\":\"2021-05-25T11:28:55.777700348+02:00\",\"directory\":\"/myfolder\",\"isDir\":false,\"path\":\"/log.txt\",\"recoveryTime\":0,\"permanentDelete\":false,\"nodeAddress\":\"0xcd6E217f3040e41544F6A110fA6099FeD2a60365\",\"appDeleted\":false,\"userDeleted\":false}]"
],
[
"[{\"active\":true,\"enable\":true,\"version\":1,\"hash\":\"QmVKcXzKdmHkcXRbA5jnSiHbLyBPkUDqyqutrvxCyp9hu4\",\"filesize\":17,\"replication\":1,\"filetype\":\"\",\"encryptionType\":1,\"encryptionKey\":\"bc6f8aae9d628bc1b8eb8947f2fd1a87e5083886b2073cf700d7a9a5dc008dab\",\"lastUpdated\":\"2021-05-25T11:28:57.412568461+02:00\",\"directory\":\"/myfolder\",\"isDir\":false,\"path\":\"/write.txt\",\"recoveryTime\":0,\"permanentDelete\":false,\"nodeAddress\":\"0xcd6E217f3040e41544F6A110fA6099FeD2a60365\",\"appDeleted\":false,\"userDeleted\":false}]"
],
[
"[{\"active\":true,\"enable\":true,\"version\":1,\"hash\":\"QmP9NGBiUuQx1BGHWSyGG273FUe2oqJ6tzcq5s9Syc1j6p\",\"filesize\":118352,\"replication\":1,\"filetype\":\"\",\"encryptionType\":1,\"encryptionKey\":\"bc6f8aae9d628bc1b8eb8947f2fd1a87e5083886b2073cf700d7a9a5dc008dab\",\"lastUpdated\":\"2021-05-25T11:28:59.164787961+02:00\",\"directory\":\"/myfolder\",\"isDir\":false,\"path\":\"/giphy.gif\",\"recoveryTime\":0,\"permanentDelete\":false,\"nodeAddress\":\"0xcd6E217f3040e41544F6A110fA6099FeD2a60365\",\"appDeleted\":false,\"userDeleted\":false}]"
]
]
}