-
-
<span style=”color: #500050; font-family: arial, sans-serif; font-size: 12.8px; line-height: normal;”>Our primary usecase involves using it via your REST APIs (SDK) to integrate with our server. We are authenticating using Pin based mechanism and want to test it. I am trying to upload file but not able to upload.</span>
We are doing following Steps:
headers = {
‘Content-Type’: ‘application/binary’,
‘Authorization’: ‘Basic ZGV2QHNpbXBsb3RlbC5jb206UkVWTU1EQUFBQUFBQUFBU2RRQTVwUllXNWN5Z0pqcmZBYjdta29USzJXV0w4V09MRHRla0ljUHR3c1VpMTBrRzNTMW9PaGlTa1NTL2Jwai90bVNYeUZLenl5eEg2WTVYR096WXNCbXA=’,
‘Accept’: ‘application/binary’
}
1) Add document metadata
PUT:
https://rest.smartvault.com/nodes/pth/SimpDev1/dev1vault/test1
data:
{
“create_file”: [
{“name”: “simpdev.txt”}
]
}
Response:
{
“error”: {
“success”: true
},
“message”: {
“name”: “test1”,
“createdOn”: “2016-04-15T00:02:29-06:00”,
“modifiedOn”: “2016-04-15T00:02:29-06:00”,
“uri”: “/nodes/pth/SimpDev1/dev1vault/test1”,
“dav_uri”: “/nodes/pth/SimpDev1/dev1vault/test1”,
“your_permissions”: 8309,
“nodeType”: “FolderNodeType”,
“link_uri”: “https://my.smartvault.com/users/secure/ElementBrowser.aspx?type=Folder&id=XOr12spGMkm7_sYInnytzA”,
“children”: [
{
“name”: “simpdev.txt”,
“description”: “”,
“createdOn”: “2016-04-15T01:04:45-05:00”,
“modifiedOn”: “2016-04-15T01:04:45-05:00”,
“uri”: “/nodes/pth/SimpDev1/dev1vault/test1/simpdev.txt”,
“dav_uri”: “/nodes/pth/SimpDev1/dev1vault/test1/simpdev.txt”,
“download_uri”: “/files/id/Document/lpQYottqgUqGvMOIxGYb1g”,
“your_permissions”: 113,
“nodeType”: “FileNodeType”,
“link_uri”: “https://my.smartvault.com/users/secure/ElementBrowser.aspx?type=Document&id=lpQYottqgUqGvMOIxGYb1g”,
“preview_link_uri”: “https://my.smartvault.com/users/secure/ElementBrowser.aspx?type=Document&id=lpQYottqgUqGvMOIxGYb1g”,
“download_link_uri”: “https://my.smartvault.com/users/secure/DownloadFile.aspx?d=lpQYottqgUqGvMOIxGYb1g”,
“fileExProperties”: {
“preview_available”: “False”,
“thumbnail_available”: “False”
},
“versionExProperties”: {
“uuid”: “lpQYottqgUqGvMOIxGYb1g”,
“version”: 0,
“md5”: “d41d8cd98f00b204e9800998ecf8427e”,
“type”: “Document”,
“parent_uuid”: “XOr12spGMkm7_sYInnytzA”,
“parent_type”: “Folder”
},
“auto_name”: false,
“auto_description”: false
}
]
}
}
2)Add document version
NOTE: we are using lpQYottqgUqGvMOIxGYb1g as file ID
PUT:
https://rest.smartvault.com/nodes/upload/lpQYottqgUqGvMOIxGYb1g
data:
{
“length”: 1024
}
Response:
{
“error”: {
“success”: true
},
“message”: {
“createdOn”: “2016-04-15T00:04:45-06:00”,
“modifiedOn”: “2016-04-15T00:04:45-06:00”,
“uri”: “/nodes/upload/lpQYottqgUqGvMOIxGYb1g”,
“fileExProperties”: {
“preview_available”: “False”,
“thumbnail_available”: “False”,
“document_state”: “DocumentPending”,
“upload_uri”: “/nodes/upload/lpQYottqgUqGvMOIxGYb1g/bbV2vC9Nc06Jaok1imXfvA”,
“upload_status”: {
“length”: 1024,
“original_length”: 1024,
“md5_checksum”: “”,
“compressed”: false,
“write_offset”: 0
},
“storage_location”: “CLOUD”,
“account_name”: “SimpDev1”
}
}
}
3) Upload file bits
NOTE: Assuming bbV2vC9Nc06Jaok1imXfvA as a version id
PUT:
https://rest.smartvault.com/nodes/upload/lpQYottqgUqGvMOIxGYb1g/bbV2vC9Nc06Jaok1imXfvA
Uploaded: Trying to upload small doc file
Response:
<envelope>
<error>
<success>false</success>
<error_code>-2147467259</error_code>
<error_text>Value does not fall within the expected range.</error_text>
</error>
</envelope>
-
Hello,
I suspect your document length in step two is what’s causing the issue. The length entered when creating a new version should be exactly the byte length of the text you wish to upload. If that doesn’t solve your problem, please let me know.
-Juan Castillo
-
Not able to upload file
Viewing 1 reply thread