Skip to main content

Copy

This api will copy entities from source storage to the destination.

Copy Api options

The options available in this api are described below:

Option nameTypeDefault ValueRequiredDescription
SourcePathstringThe storage path from which the entities are to be copied
DestinationPathstringThe storage path to which the entities are to be copied
IncludestringInclude entities matching pattern
ExcludestringExclude entities matching pattern
MinAgestringFilter entities older than this in second or suffix
ms | s | m | h | d | w | M | y
MaxAgestringFilter entities younger than this in second or suffix
ms | s | m | h | d | w | M | y
MinSizestringFilter entities bigger than this in KiB or suffix
B | K | M | G | T | P
MaxSizestringFilter entities smaller than this in KiB or suffix
B | K | M | G | T | P
CaseSensitiveboolfalseIgnore or apply case sensitive in filters
RecurseboolfalseApply recursion on filtering entities in the specified path
ClearDestinationPathboolfalseClearing all entities and other things in the destination path before starting the copy operation
OverWriteDataboolfalseOverwriting the data if the entity exists on the destination

Calling Copy Api

For calling this api, the following details are required to apply:

note

The options and parameters introduced in the previous section must be included as json data in the request body part.

URLMethodContentTypeBody
http://localhost:5860/storage/copyPOSTapplication/json
{
"sourcePath": <STRING VALUE>,
"destinationPath": <STRING VALUE>,
"include": <STRING VALUE>,
"exclude": <STRING VALUE>,
"minAge": <STRING VALUE>,
"maxAge": <STRING VALUE>,
"minSize": <STRING VALUE>,
"maxSize": <STRING VALUE>,
"caseSensitive": <BOOLEAN VALUE>,
"recurse": <BOOLEAN VALUE>,
"clearDestinationPath": <BOOLEAN VALUE>,
"overWriteData": <BOOLEAN VALUE>
}

Now, if we want to have these details in the form of an http api call, open a new terminal and enter the following command:

info

First of all make sure flowsynx is running.

curl -X POST -H "Content-Type: application/json" -d '{ "sourcePath": "/sourcePath/", "destinationPath": "/destinationPath", "include": "", "exclude": "", "minAge": "", "maxAge": "", "minSize": "", "maxSize": "", "caseSensitive": false, "recurse": true, "clearDestinationPath": false, "overWriteData": true }' http://localhost:5860/storage/copy

Also you can use Http Api test clients to test this api. Anyway, after executing this api, a result like below will be obtained.

{
"data": null,
"messages": [
"The copy was done successfully."
],
"succeeded": true
}

The answer is divided into three data, messages, and succeeded parts. succeeded indicates the status of the execution of this api which is boolean value and can be true or false. messages also indicates the list of possible messages that are returned with the response. data contains the data to be returned.