Upload File Or Create Folder

put

/files/{path}

Uploads a file to Essbase.

Supported file types include text files, rules files, calculation script files, and MaxL script files.

If there is no content type, and a folder name is specified in the URL, a folder is created.

To upload a file as a single stream, the file size must be known in advance. Most HTTP clients set the Content-Length header automatically. With chunked uploads, however, the client does not send the Content-Length. In those cases, the client must set the CLI-Content-Length to the file size in bytes for a successful upload. Otherwise, the server rejects the request with File upload failed. File is empty. error.

Request

Path Parameters
  • Catalog path. If Content-Type=application/octet-stream, this is a file name. Otherwise, it is a folder name.

Query Parameters
Header Parameters
Back to Top

Response

200 Response

OK

The file uploaded successfully (if Content-Type is application/octet-stream), or the folder was created successfully (if there is no Content-Type).

400 Response

Bad Request

Logged in user may not have appropriate permissions, or the file or folder may already exist.

500 Response

Internal Server Error.

Back to Top

Examples

The following examples show:

1) Upload files to an Essbase cube directory.

2) Upload a file to a shared directory.

3) Upload a file as a single stream

This example uses cURL to access the REST API from a Windows shell script. The calling user's ID and password are variables whose values are set in properties.bat.

cURL Command 1

This example uploads Data_Basic.txt to the Sample Basic cube directory. In case the file already exists, this API overwrites the file, because overwrite=true is passed as a query parameter.

call properties.bat
curl -X PUT "https://192.0.2.1:443/essbase/rest/v1/files/applications/Sample/Basic/Data_Basic.txt?overwrite=true" -H "accept: application/json"

Response Body 1

The response includes a download link.

[
  {
    "rel": "download",
    "href": "https://192.0.2.1:443/essbase/rest/v1/files/applications/Sample/Basic/Data_Basic.txt",
    "method": "GET",
    "type": "application/octet-stream"
  }
]

cURL Command 2

This example uploads datafile.txt to the shared directory in the Essbase file catalog.

call properties.bat
curl -X PUT "https://myserver.example.com:9001/essbase/rest/v1/files/shared/datafile.txt" -H "Accept:application/json" -H "Content-Type:application/octet-stream" --data-binary @datafile.txt -u %User%:%Password%

Response Body 2

The response includes a download link.

[ {
  "rel" : "download",
  "href" : "https://myserver.example.com:9001/essbase/rest/v1/files/shared/datafile.txt",
  "method" : "GET",
  "type" : "application/octet-stream"
} ]

cURL Command 3

This example uploads the test.txt file as a single stream.

call properties.bat
curl --location --request PUT 'http://myserver.example.com:9000/essbase/rest/v1/files/users/weblogic/test.txt?overwrite=true' \
--header 'Content-Type: application/octet-stream' \
--header 'CLI-Content-Length: 94412' \
--header 'Authorization: Basic d2VibG9naWM6d2VsY29tZTE=' \
--header 'Cookie: JSESSIONID=aME_hEhIMK-7jEKlLPlHGOXz9TWkTPidy_ZuLTCoDC3fCTL5TQY5!-681741938; sessionExpiry=1779185760164' \
--data-binary '@archive.zip'
Back to Top