Copy a File Between Instances (v2)

Use this REST API to copy a file from one environment (source) to another environment (target).

This API is executed on the target environment after details are provided for the source environment from which the file is to be copied. This feature gives you flexibility in copying files from one cloud environment to another.

Required Roles

Service Administrator

Any predefined role and the Migrations – Administer granular role

REST Resource

POST /interop/rest/v2/files/copyfrominstance

Request

Supported Media Types: application/json

Table 9-100 Parameters

Name Description Type Required Default
sourceFileName Name of the file to copy Payload Yes None
userName User with the Service Administrator predefined role in the source instance Payload Yes None
pwd Base64-encoded password Payload Yes None
sourceURL The URL of the source instance Payload Yes None
targetFileName Name of the file to be copied to the target environment Payload Yes None

Example URL and Payload

https://<BASE-URL>/interop/rest/v2/files/copyfrominstance
{
  "sourceFileName": "FILE_TO_BE_COPIED",
  "userName": "USER_NAME",
  "pwd": "BASE64ENCODED_PASSWORD",
  "sourceURL": "SOURCE_URL"
  "targetFileName": "TARGET_FILENAME"
}

Response

Supported Media Types: application/json

Table 9-101 Parameters

Name Description
details In the case of errors, details are published with the error string
status See Migration Status Codes
links Detailed information about the link
href Links to API call or status API
action The HTTP call type
rel Possible values: self or Job Status. If the value is set to Job Status, you can use the href to get the status
data null

Example of Response Body


	"status": -1,
	"items": null,
	"links": [{
		"rel": "self",
		"href": "https://<BASE-URL>/interop/rest/v2/files/copyfrominstance",
		"data": null,
		"action": "POST"
	}, {
		"rel": "Job Status",
		"href": "https://<BASE-URL>/interop/rest/v2/status/jobs/<JOB_ID>",
		"data": null,
		"action": "GET"
	}],
	"details": null
}

Sample cURL command

curl -X POST -s -u '<USERNAME>:<PASSWORD>' -o response.txt -D respHeader.txt -H 'Content-Type: application/json' -d '{"sourceFileName":"FILE_TO_BE_COPIED", "sourceURL":"SOURCE_URL","userName":"USER_NAME","targetFileName":"TARGET_FILENAME","pwd":"BASE64ENCODED_PASSWORD"}' 'https://<BASE URL>/interop/rest/v2/files/copyfrominstance'