All URIs are relative to https://sandbox.zenodo.org/api
Method | HTTP request | Description |
---|---|---|
create_file | POST /deposit/depositions/{depositId}/files | Create a new file |
delete_file | DELETE /deposit/depositions/{depositId}/files/{fileId} | Delete an existing deposition file resource. Note, only deposition files for unpublished depositions may be deleted. |
get_file | GET /deposit/depositions/{depositId}/files/{fileId} | Retrieve a single deposition file. |
list_files_for_deposit | GET /deposit/depositions/{depositId}/files | List of files for deposit |
sort_files | PUT /deposit/depositions/{depositId}/files | Sort the files for a deposit |
update_file | PUT /deposit/depositions/{depositId}/files/{fileId} | Update a deposition file resource. Currently the only use is renaming an already uploaded file. If you want to replace the actual file, please delete the file and upload a new file. |
DepositionFile create_file(deposit_id, file, filename)
Create a new file
# load the gem
require 'zenodo_client'
# setup authorization
ZenodoClient.configure do |config|
# Configure API key authorization: access_token
config.api_key['access_token'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['access_token'] = 'Bearer'
end
api_instance = ZenodoClient::FilesApi.new
deposit_id = 56 # Integer |
file = File.new('/path/to/file.txt') # File | The file to upload
filename = 'filename_example' # String | Filename for file
begin
#Create a new file
result = api_instance.create_file(deposit_id, file, filename)
p result
rescue ZenodoClient::ApiError => e
puts "Exception when calling FilesApi->create_file: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
deposit_id | Integer | ||
file | File | The file to upload | |
filename | String | Filename for file |
- Content-Type: multipart/form-data
- Accept: application/json
DepositionFile delete_file(deposit_id, file_id)
Delete an existing deposition file resource. Note, only deposition files for unpublished depositions may be deleted.
# load the gem
require 'zenodo_client'
# setup authorization
ZenodoClient.configure do |config|
# Configure API key authorization: access_token
config.api_key['access_token'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['access_token'] = 'Bearer'
end
api_instance = ZenodoClient::FilesApi.new
deposit_id = 56 # Integer |
file_id = 'file_id_example' # String |
begin
#Delete an existing deposition file resource. Note, only deposition files for unpublished depositions may be deleted.
result = api_instance.delete_file(deposit_id, file_id)
p result
rescue ZenodoClient::ApiError => e
puts "Exception when calling FilesApi->delete_file: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
deposit_id | Integer | ||
file_id | String |
- Content-Type: application/json, multipart/form-data
- Accept: application/json
DepositionFile get_file(deposit_id, file_id)
Retrieve a single deposition file.
# load the gem
require 'zenodo_client'
# setup authorization
ZenodoClient.configure do |config|
# Configure API key authorization: access_token
config.api_key['access_token'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['access_token'] = 'Bearer'
end
api_instance = ZenodoClient::FilesApi.new
deposit_id = 56 # Integer |
file_id = 'file_id_example' # String |
begin
#Retrieve a single deposition file.
result = api_instance.get_file(deposit_id, file_id)
p result
rescue ZenodoClient::ApiError => e
puts "Exception when calling FilesApi->get_file: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
deposit_id | Integer | ||
file_id | String |
- Content-Type: application/json, multipart/form-data
- Accept: application/json
Array<DepositionFile> list_files_for_deposit(deposit_id)
List of files for deposit
# load the gem
require 'zenodo_client'
# setup authorization
ZenodoClient.configure do |config|
# Configure API key authorization: access_token
config.api_key['access_token'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['access_token'] = 'Bearer'
end
api_instance = ZenodoClient::FilesApi.new
deposit_id = 56 # Integer |
begin
#List of files for deposit
result = api_instance.list_files_for_deposit(deposit_id)
p result
rescue ZenodoClient::ApiError => e
puts "Exception when calling FilesApi->list_files_for_deposit: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
deposit_id | Integer |
- Content-Type: application/json, multipart/form-data
- Accept: application/json
Array<DepositionFile> sort_files(deposit_id, deposit_file)
Sort the files for a deposit
# load the gem
require 'zenodo_client'
# setup authorization
ZenodoClient.configure do |config|
# Configure API key authorization: access_token
config.api_key['access_token'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['access_token'] = 'Bearer'
end
api_instance = ZenodoClient::FilesApi.new
deposit_id = 56 # Integer |
deposit_file = ZenodoClient::DepositionFile.new # DepositionFile | The order of files, use only the id portion of the array of files
begin
#Sort the files for a deposit
result = api_instance.sort_files(deposit_id, deposit_file)
p result
rescue ZenodoClient::ApiError => e
puts "Exception when calling FilesApi->sort_files: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
deposit_id | Integer | ||
deposit_file | DepositionFile | The order of files, use only the id portion of the array of files |
- Content-Type: application/json, multipart/form-data
- Accept: application/json
DepositionFile update_file(deposit_id, file_id, deposit_file)
Update a deposition file resource. Currently the only use is renaming an already uploaded file. If you want to replace the actual file, please delete the file and upload a new file.
# load the gem
require 'zenodo_client'
# setup authorization
ZenodoClient.configure do |config|
# Configure API key authorization: access_token
config.api_key['access_token'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['access_token'] = 'Bearer'
end
api_instance = ZenodoClient::FilesApi.new
deposit_id = 56 # Integer |
file_id = 'file_id_example' # String |
deposit_file = ZenodoClient::DepositionFile.new # DepositionFile |
begin
#Update a deposition file resource. Currently the only use is renaming an already uploaded file. If you want to replace the actual file, please delete the file and upload a new file.
result = api_instance.update_file(deposit_id, file_id, deposit_file)
p result
rescue ZenodoClient::ApiError => e
puts "Exception when calling FilesApi->update_file: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
deposit_id | Integer | ||
file_id | String | ||
deposit_file | DepositionFile |
- Content-Type: application/json, multipart/form-data
- Accept: application/json