Upload File or Create Folder
/essbase/rest/v1/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.
Request
- application/octet-stream
-
path(required): string
Pattern:
.+
Catalog path. If
Content-Type=application/octet-stream
, this is a file name. Otherwise, it is a folder name.
-
overwrite(required): boolean
Applicable only for adding a file. Overwriting folders is not supported.
Default Value:false
-
append: boolean
Append to existing file?
Default Value:false
Response
- application/json
- application/xml
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).
object
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.
Examples
The following examples show 1) how to upload files to an Essbase cube directory, and 2) how to upload a file to a shared directory.
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"
} ]