The API allows to list folders and display information of resources. In addition it also has to capability to upload new files into the repository as well as deleting old ones.
Request detail information about the folders and resources in the repository.
REQUEST Fields | Value Type | Description |
---|---|---|
force (optional) | boolean | The optional parameter force will overwrite the resources sent with an upload request if they exist. It is possible, that the repository still denies the request due to missing permissions. |
RESPONSE Fields | Value Type | Description |
---|---|---|
name | string | The name of the resource |
type | string | The type of the resource, either FOLDER or RESOURCE |
isReadable | boolean | true , if the resource is readable |
isWritable | boolean | true , if the resource is writable |
created | number | The timestamp the resource has been created |
lastModified | number | The timestamp the resource has been modified last |
sizeInBytes | number | The size in bytes of the given resource |
tags | array | An array with tags that were defined for a resource in the repository |
sha256 | string | The SHA256 hash of the resource. Resource of type "FOLDER" will always have null as response. |
Note: not all Response fields have to be set and can have null
or 0
as value.
# Request # Use user:password for authorization GET /api/repository/my/resource/folder HTTP/1.1 Authorization: Bearer VGhpcyBpcyBqdXN0IGEgZGVtbyBhY2Nlc3MgdG9rZW4u # Response - Task will be executed HTTP/1.1 200 OK Content-Type: application/json Content-Length: <CONTENT LENGTH> [ { "name": "anotherFolder", "type": "FOLDER", "isReadable": true, "isWritable": true, "created": 0, "lastModified": 0, "sizeInBytes": 0, "tags": null }, { "name": "my Report.rpt", "type": "RESOURCE", "isReadable": true, "isWritable": true, "created": 1559623786000, "lastModified": 1559712597000, "sizeInBytes": 2395, "tags": [], "sha256": "470771ebb2c4e4fb801c0b93f4886869196045c443b79ef9e75cdf79938f4a0c" }, { ... } ]
# Browser access http://127.0.0.1:9000/api/repository/my/resource/folder # Shell access using curl curl -LsH "Authorization: Bearer <access_token>" "http://127.0.0.1:9000/api/repository/my/resource/folder" # Shell access using curl using username and password curl -Lsu username:password "http://127.0.0.1:9000/api/repository/my/resource/folder"
The API supports sending multipart/form-data
requests containing (multiple) resources to upload into the repository. Resources will be stored in the given sub-directory.
The response of an upload is the list of resource files sent to the server.
Note: If a resource already exists on the server, the parameter force=1
can be added to the request to first delete the previously existing resource.
Note: Folders that do not yet exists in the repository will be created upon upload, if possible.
# Uploading a single file using curl curl -LsH "Authorization: Bearer <access_token>" --upload-file "report.rpt" "http://127.0.0.1:9000/api/repository/my/resource/folder" # Uploading a single file using curl using username and password curl -Lsu username:password --upload-file "report.rpt" "http://127.0.0.1:9000/api/repository/my/resource/folder" # Uploading a single file using curl - overwriting a previous file of the same name curl -LsH "Authorization: Bearer <access_token>" --upload-file "report.rpt" "http://127.0.0.1:9000/api/repository/my/resource/folder?delete=true" # Uploading a single file using curl - overwriting a previous file of the same name using username and password curl -Lsu username:password --upload-file "report.rpt" "http://127.0.0.1:9000/api/repository/my/resource/folder?delete=true" # Uploading a multiple file using curl curl -LsH "Authorization: Bearer <access_token>" --upload-file "{report.rpt,report2.rpt}" "http://127.0.0.1:9000/api/repository/my/resource/folder" # Uploading a multiple file using curl using username and password curl -Lsu username:password --upload-file "{report.rpt,report2.rpt}" "http://127.0.0.1:9000/api/repository/my/resource/folder"
The API supports sending PUT
requests to upload files into the repository. Resources will be stored in the given sub-directory and file name.
The response of an upload is a list containing the resource file sent to the server.
Note: If a resource already exists on the server, the parameter force=1
can be added to the request to first delete the previously existing resource.
Note: Folders that do not yet exists in the repository will be created upon upload, if possible.
# Uploading a single file using curl curl -LsH "Authorization: Bearer <access_token>" --request PUT "http://127.0.0.1:9000/api/repository/my/resource/folder/myfile.ext" --data-binary "@path/to/myfile.ext" # Uploading a single file using curl using username and password curl -Lsu username:password --request PUT "http://127.0.0.1:9000/api/repository/my/resource/folder/myfile.ext" --data-binary "@path/to/myfile.ext"
The API supports sending DELETE
requests to remove files or directories from the repository. This is a destructive action and should be considered carefully.
Note: If a folder that contains more files or folders should be deleted, the parameter force=1
can be added to the request to force the deletion of the content therein as well. Otherwise only empty folders can be removed.
# Uploading a single file using curl curl -LsH "Authorization: Bearer <access_token>" --request DELETE "http://127.0.0.1:9000/api/repository/my/resource/folder/myfile.ext" # Uploading a single file using curl using username and password curl -Lsu username:password --request DELETE "http://127.0.0.1:9000/api/repository/my/resource/folder/myfile.ext"