Onedata API Reference

REST API references for Onezone, Oneprovider, and Onepanel.

Create transfer

POST /transfers

Creates transfer, which is a process of data movement between providers. This operation is asynchronous and it can take a long time depending on the size of the data to move.

The following types of transfer are supported:

  • replication - process of copying data to achieve a complete replica in provider specified as replicatingProviderId. The data will be copied from one or more providers in the space that hold replicas or some fragments. This operation requires space_schedule_replication privilege.
  • eviction - process of removing replica(s) from provider specified in evictingProviderId. Eviction is safe - will succeed only if there is at least one complete replica (accumulated) on other providers in the space. This operation requires space_schedule_eviction privilege.
  • migration - replication followed by eviction. This operation requires both space_schedule_replication and space_schedule_eviction privileges.

Each transfer applies to one or more files/directories, depending on chosen dataSourceType:

  • file - a single chosen file or directory
  • view - all files that are returned as a result of querying chosen view

In case of a directory, the transfer applies to all its subfiles and subdirectories (recursively).

Example cURL requests

Creates file replication

curl -H "X-Auth-Token: $TOKEN" -X POST \
-H "Content-type: application/json" \
-d '{ "type": "replication", "replicatingProviderId": $PROVIDER_ID, "dataSourceType": "file", "fileId": $FILE_ID }' \
"https://$HOST/api/v3/oneprovider/transfers"

Request body

application/json

Transfer properties.

PropertyType & Description
type
string

Requested type of transfer. Depending on selected type specifying also replicatingProviderId, evictingProviderId or both may be required.

Enum:
replicationevictionmigration
replicatingProviderId
string

Id of provider to which data will be copied, ensuring that the provider has a complete replica at the end of the process. The data will be copied from one or more providers in the space that hold replicas or some fragments.

evictingProviderId
string

Id of provider from which replica(s) are to be removed. Eviction is safe - will succeed only if there is at least one complete replica (accumulated) on other providers in the space.

callback
string

This parameter allows the user to specify a REST callback URL which will be called (http POST request with transfer Id in body) when the transfer is complete.

dataSourceType
string
Enum:
fileview

Request Examples

Shell
oneprovider-rest-cli createTransfer type==replication replicatingProviderId==$PROVIDER_ID dataSourceType==file fileId==$FILE_ID

Responses

application/json
201

The request has been accepted and the result is the transfer Id. Also URI of the transfer in form https://$HOST/api/v3/oneprovider/transfers/{id} is returned in the response Location header.

PropertyType & Description
transferId
string

Transfer Id.

400

Invalid request.

PropertyType & Description
error
string

Identifier representing internal error code.

error_description
string

Detailed error message.

Example

application/json
{
  "error": "invalid_token",
  "error_description": "Provided token could not be validated."
}
403

Forbidden request.

PropertyType & Description
error
string

Identifier representing internal error code.

error_description
string

Detailed error message.

Example

application/json
{
  "error": "invalid_token",
  "error_description": "Provided token could not be validated."
}
404

File not found.

PropertyType & Description
error
string

Identifier representing internal error code.

error_description
string

Detailed error message.

Example

application/json
{
  "error": "invalid_token",
  "error_description": "Provided token could not be validated."
}
500

Internal server error.

PropertyType & Description
error
string

Identifier representing internal error code.

error_description
string

Detailed error message.

Example

application/json
{
  "error": "invalid_token",
  "error_description": "Provided token could not be validated."
}