Copy to SFTP (v2)

Copies a file or a backup snapshot from the current cloud environment (the source) to the SFTP server (the target).

You can copy any file or snapshot available in Oracle Fusion Cloud Enterprise Performance Management. For example, if you export data to a file, the exported file is stored in the Outbox. You can then use this API to copy the file directly to an SFTP server where you have an account.

Required Roles

Service Administrator

REST Resource

POST /interop/rest/v2/config/services/copytosftp

Request

Supported Media Types: application/json

Table 10-88 Parameters

Name Description Type Required Default
userName ID of a user who has the required access rights to write to the SFTP server Payload Yes None
password Password associated with the user. Required if privatekey is not specified. Payload Yes None
url

URL for the source file on the SFTP server in the following format:

sftp://myserver/mydir/File_New.txt

Payload Yes None
filePath

Name of the file (with path) to be copied to the SFTP Server. If you are copying a snapshot, do not specify the ZIP extension.

Examples:

Artifact Snapshot_24_Sept_2020

inbox/File_new.txt

Payload Yes None
privatekey Base 64 encoded private key content. Required if password is not specified. Payload Optional None
passphrase Passphrase associated with private key(if any) Payload Optional None

Note:

For private key-based authentication (with or without passphrase), the public key corresponding to the provided private key must be added to the authorized_keys file on the SFTP server. This is required for successful authentication. If the SFTP server does not have the correct public key in its authorized_keys file under the appropriate user account, authentication will fail.

Sample Request Payload - Password based authentication

{
    "userName" : "username",
    "password" : "password",
    "url"      : "sftp://mysever/mydir/File_New.txt",
    "filePath" : "inbox/File_new.txt"
}

Sample Request Payload - Private Key based authentication (without passphrase)

{
    "userName"   : "username",
    "privateKey" : "privateKey",
    "url"        : "sftp://mysever/mydir/File_New.txt",
    "filePath"   : "inbox/File_new.txt"
}

Sample Request Payload - Private Key based authentication (with passphrase)

{
    "userName"   : "username",
    "privateKey" : "privateKey",
    "passphrase" : "passphrase",
    "url"        : "sftp://mysever/mydir/File_New.txt",
    "filePath"   : "inbox/File_new.txt"
}

Response

Supported Media Types: application/json

Table 10-89 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 and HTTP call type
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 of the job
data Parameters as key value pairs passed in the request

Example of Response Body

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

Sample cURL command - Password based authentication

curl -X POST -s -u '<USERNAME>:<PASSWORD>' -o response.txt -D respHeader.txt -H 'Content-Type: application/json' \
-d '{"url":"SFTP_URL ","userName":"USER_NAME","password":"PASSWORD","filePath":"FILEPATH/FILENAME"}'\
'https://<BASE URL>/interop/rest/v2/config/services/copytosftp'

Sample cURL command - Private Key based authentication (without passphrase)

curl -X POST -s -u '<USERNAME>:<PASSWORD>' -o response.txt -D respHeader.txt -H 'Content-Type: application/json' \
-d '{"url":"SFTP_URL ","userName":"USER_NAME","privateKey":"PRIVATE_KEY","filePath":"FILEPATH/FILENAME"}'\
'https://<BASE URL>/interop/rest/v2/config/services/copytosftp'

Sample cURL command - Private Key based authentication (with passphrase)

curl -X POST -s -u '<USERNAME>:<PASSWORD>' -o response.txt -D respHeader.txt -H 'Content-Type: application/json' \
-d '{"url":"SFTP_URL ","userName":"USER_NAME","privateKey":"PRIVATE_KEY", "passphrase":"PASSPHRASE","filePath":"FILEPATH/FILENAME"}'\
'https://<BASE URL>/interop/rest/v2/config/services/copytosftp'