3 Implement FTS
Use the following steps to implement FTS Services on your Unix/Linux system:
Once you have implemented FTS Services, you can Call FTS Services.
Set Environment Variables
-
Set environment variable for the
CLIENT_ID
.Command:
export CLIENT_ID="<CLIENT ID from Pre Requisites>"
Sample:
export CLIENT_ID="RGBU_MFCS_STG116_APPID"
-
Set environment variable for
CLIENT_SECRET
.Command:
export CLIENT_SECRET="<CLIENT SECRET from Pre Requisites>"
Sample:
export CLIENT_SECRET="d0503225-cc58-456a-aee9-2c97c2f1bff1"
-
Set environment variable for
OCI_IAM_BASE_URL
.Command:
export OCI_IAM_BASE_URL="<OCI IAM URL from Pre Requisites>"
Sample:
export OCI_IAM_BASE_URL="https://idcs-ca69887b7ea4451ebdf967e2a383629e.identity.c9dev2.oc9qadev.com:443"
-
Set environment variable for
OCI_IAM_SCOPE
.Command:
export OCI_IAM_SCOPE="OCI IAM SCOPE from Pre Requisites"
Sample:
export OCI_IAM_SCOPE="rgbu:merch:MFCS-STG116"
-
Set environment variable for hostname.
The format that should be used for the hostname is
rex.retail.<Region Name>.ocs.oraclecloud.com/<Customer Subnamespace>/RmsPlatformServices/services/private/FTSWrapper
, where:-
<Region Name>
will be the region for your data center. -
<Customer Subnamespace>
will be specific to your company’s name and environment (production, stage, and so on).
Command:
export FTS_HOST_NAME="https://rex.retail.<Region from Pre Requisites>.ocs.oraclecloud.com/<Customer Subnamespace from Pre Requisites>/RmsPlatformServices/services/private/FTSWrapper
Sample:
export FTS_HOST_NAME="https://rex.retail.us-phoenix-1.ocs.oc-test.com/rgbu-rex-rgbu-stg116-mfcs/RmsPlatformServices/services/private/FTSWrapper"
-
Retrieve OAUTH Token
To invoke Merchandising cloud FTS Services, you need to obtain an access token and use it as a bearer token.
-
Run the
curl
command below to retrieve access token:Command:
export OCI_IAM_TOKEN=$(curl -u $CLIENT_ID:$CLIENT_SECRET -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST $OCI_IAM_BASE_URL/oauth2/v1/token -d "grant_type=client_credentials&scope=$OCI_IAM_SCOPE" | jq -r '.["access_token"]')
Note:
A token is generally valid for 1 hour. -
Check the
OCI_IAM_TOKEN
variable.Command:
echo $OCI_IAM_TOKEN
Call FTS Services
Once you have completed configuration, you can call FTS services from your Unix/Linux server.
Register a New Storage Prefix
Object Storage bucket prefixes must be registered to FTS. Predefined prefixes are already available and it is recommended you use those. Refer to the predefined prefixes in the “File Transfer Services (FTS)” section of the Merchandising Operations Guide Volume 2.
If new prefixes are required, these will need to be registered. Please note this is only required only if you are adding additional new storage prefixes. If you are using existing, predefined prefixes, you do not need to use this service.
To call the Register a New Storage Prefix service, append /register/<new prefix>
to
the FTS_HOST_NAME
.
Command:
curl -X PUT $FTS_HOST_NAME/register/<new prefix> -H "Accept-Language: en-US" -H "Authorization: Bearer $OCI_IAM_TOKEN"
Sample:
$ curl -X PUT $FTS_HOST_NAME/register/test_prefix -H "Accept-Language: en-US" -H "Authorization: Bearer $OCI_IAM_TOKEN"
List Files
To call the FTS list file service, append /listfiles
to the FTS_HOST_NAME
.
Command:
curl $FTS_HOST_NAME/listfiles -H "Accept-Language: en-US" -H "Authorization: Bearer $OCI_IAM_TOKEN"

Uploading Files
Uploading a file using the FTS service is a two-stage process. Calling the Retrieve PAR for Uploading Files service
returns a Pre Authenticated Request (PAR) in the accessUri
key of the response. That PAR is then used
to perform the upload of the file to object storage.
-
To call the Retrieve PAR for Uploading Files, append
/upload
to theFTS_HOST_NAME
. The Retrieve PAR for Uploading Files service expects a JSON Request body with the following structure:{ "listOfFiles": [ { "storagePrefix": "string", "fileName": "string" } ] }
Command:
export ACCESS_URI=$(curl "$FTS_HOST_NAME/upload" -H "Accept-Language: en-US" -H "Authorization: Bearer $OCI_IAM_TOKEN" -H "Content-Type: application/json" -d '{"listOfFiles": [{"storagePrefix": "<prefix>", "fileName": "<filename>"}]}' | jq -r '.parList[] | .accessUri')
Sample:
export ACCESS_URI=$(curl "$FTS_HOST_NAME/upload" -H "Accept-Language: en-US" -H "Authorization: Bearer $OCI_IAM_TOKEN" -H "Content-Type: application/json" -d '{"listOfFiles": [{"storagePrefix": "incoming", "fileName": "RTLOG_1111_01.zip"}]}' | jq -r '.parList[] | .accessUri')
-
Check the value of
ACCESS_URI
.Command:
echo $ACCESS_URI
-
Upload the file to Object Storage using the PAR.
Command:
curl "$ACCESS_URI" --upload-file "<full path and filename"
Sample:
curl "$ACCESS_URI" --upload-file "RTLOG_1111_01.zip"
-
Verify the upload using the List Files service.
Command:
curl $FTS_HOST_NAME/listfiles -H "Accept-Language: en-US" -H "Authorization: Bearer $OCI_IAM_TOKEN"
Downloading Files
Downloading a file through the FTS service is a two-stage process. Calling the Retrieve PAR for Downloading Files
service returns a Pre Authenticated Request (PAR) in the accessUri
key of the response. The PAR is
then used to perform the download of the file from object storage.
-
To call the Retrieve PAR for Downloading Files, append
/download
toFTS_HOST_NAME
. The Retrieve PAR for Uploading Files service expects a JSON Request body with the following structure:{ "listOfFiles": [ { "storagePrefix": "string", "fileName": "string" } ] }
Command:
export ACCESS_URI=$(curl "$FTS_HOST_NAME/download" -H "Accept-Language: en-US" -H "Authorization: Bearer $OCI_IAM_TOKEN" -H "Content-Type: application/json" -d '{"listOfFiles": [{"storagePrefix": "<prefix>", "fileName": "<filename>"}]}' | jq -r '.parList[] | .accessUri')
Sample:
export ACCESS_URI=$(curl "$FTS_HOST_NAME/download" -H "Accept-Language: en-US" -H "Authorization: Bearer $OCI_IAM_TOKEN" -H "Content-Type: application/json" -d '{"listOfFiles": [{"storagePrefix": "incoming", "fileName": "RTLOG_1111_01.zip"}]}' | jq -r '.parList[] | .accessUri')
-
Check the value of
ACCESS_URI
.Command:
echo $ACCESS_URI
-
Download the file to Object Storage using the PAR.
Command:
curl "$ACCESS_URI" -O
Sample:
curl "$ACCESS_URI" -O
-
Verify the download.
Command:
ls <filename>
Sample:
ls RTLOG_1111_01.zip
Delete Files
To call the Delete Files service:
-
Append
/delete
toFTS_HOST_NAME
. The Delete Files service expects a JSON Request body with the following structure:{ "listOfFiles": [ { "storagePrefix": "string", "fileName": "string" } ] }
Command:
curl -X DELETE $FTS_HOST_NAME/delete -H "Accept-Language: en-US" -H "Authorization: Bearer $OCI_IAM_TOKEN" -H "Content-Type: application/json" -d '{"listOfFiles": [{"storagePrefix": "<prefix>", "fileName": "<file name>"}]}'
Sample:
curl -X DELETE $FTS_HOST_NAME/delete -H "Accept-Language: en-US" -H "Authorization: Bearer $OCI_IAM_TOKEN" -H "Content-Type: application/json" -d '{"listOfFiles": [{"storagePrefix": "incoming", "fileName": "RTLOG_1111_01.zip"}]}'
-
Verify the delete using the List Files Services.
Command:
curl $FTS_HOST_NAME/listfiles -H "Accept-Language: en-US" -H "Authorization: Bearer $OCI_IAM_TOKEN"