You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Upload a file using Essbase REST API Multipart endpoint

Summary:

Essbase REST API Multipart Upload loads an empty file.


Content (required):

I'm trying to upload a file using multipart upload via rest api using this document. The file is uploaded successfully with an etag but the file has no data. Also, how should I check the status of file upload for large files to identify when to commit the upload?

https://docs.oracle.com/en/database/other-databases/essbase/21/essrt/op-files-upload-create-path-post.html


Version (include the version you are using, if applicable):

Version: 21.4.3.0.0


Code Snippet (add any code snippets that support your topic, if applicable):

Create Multipart File Upload:
url = "https://<IP>/essbase/rest/v1/files/upload-create/applications/test_app/Datamart/test.txt?overwrite=false?append=false"
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}
file=open('test.txt','rb')
response = requests.request("POST", url,  auth=<>, headers=headers,data=file, verify=False)


Upload File Part:
url2_1 = "https://<IP>/essbase/rest/v1/files/upload-part/applications/test_app/Datamart/test.txt?partNum=1&uploadId="+<uploadId> 
url2_2 = "https://<IP>/essbase/rest/v1/files/upload-part/applications/test_app/Datamart/test.txt?partNum=2&uploadId="+<uploadId>  
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/octet-stream'
}
response1 = requests.request("PUT", url2_1,  auth=<>, data=file, headers=headers, verify=False)
response2 = requests.request("PUT", url2_2,  auth=<>, data=file, headers=headers, verify=False)


Commit Partial File Upload:
url3 = "https://<IP>/essbase/rest/v1/files/upload-commit/applications/test_app/Datamart/test.txt?uploadId="+<uploadId> 
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}

payload = json.dumps({"1":<etag1>,"2":<etag2>})

response = requests.request("POST", url3,  auth=<>, headers=headers,data=payload, verify=False)
print(response.text)

OUTPUT:
{
  "etag" : "65713xxxxxxxxxxxxx"
}

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!