Copy from SFTP (v2)

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

If you are copying a backup snapshot, this API copies it from the SFTP Server and extracts its contents in Oracle Fusion Cloud EPM.

Required Roles

Service Administrator

REST Resource

POST /interop/rest/v2/config/services/copyfromsftp

Request

Supported Media Types: application/json

Table 9-88 Parameters

Name Description Type Required Default
userName ID of a user who has the required access rights to read from 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 in SFTP server in the following format:

sftp://myserver/mydir/File_New.txt

Payload Yes None
filePath

Name of the target filename (with path) of the downloaded artifact. When copying snapshots, 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 9-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/copyfromsftp",
          "action": "POST",
          "rel"   : "self",
          "data"  : null
        },
        {
          "href"  : "https://<BASE-URL>/interop/rest/v2/config/services/copyfromsftp/<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/copyfromsftp'

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/copyfromsftp'

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/copyfromsftp'