Uploading Files to the SCM Container Using File Sync Utility

You can upload files, related to Siebel CRM deployment, to the SCM container using File Sync Utility (FSU). File Sync Utility is a collection of REST APIs that makes it convenient to upload files to the SCM container. When you run File Sync Utility, it creates a folder, referred to as sync folder, and uploads files to it. You can create multiple sync folders using File Sync Utility.

The following constraints apply when uploading files through File Sync Utility:

  • You can only upload files with the following extensions: .jks, .crt, .txt, .ini, .key, .sso, .p12, .properties, .pem, .ora.
  • You can only upload files of size up to 1 MB.

This topic covers how you can use the File Sync Utility for:

Creating a Sync Folder and Uploading Files

You can create a sync folder and upload files to it using the syncutilities/upload API.

To create a sync folder and upload files to it using curl, call the syncutilities/upload API as follows:
curl -X POST \
    --user "<username>:<password>" \
    --header 'Content-Type: multipart/form-data' \
    --form "file[]=@/path/to/xxxxxxxxxx.jpg" \
    --form "file[]=@/path/to/xxxxxxxxx.crt" \
    --form "file[]=@/path/to/xxxxxxx.ini" \
    --url https:// <CM_instance_IP>:<port_num>/scm/api/v1.0/syncutilities/upload

In the example:

  • user is the credentials (user name and password) for basic authentication.
  • Content-Type is the type of request content. The value of Content-Type must be multipart/form-data.
  • form is the file to upload to the sync folder through the "file[]" key.
  • url is the POST endpoint to create a sync folder and upload files to it.

This command generates a new sync ID and creates the sync folder with the same name as the sync ID. It then uploads the files in the command to this folder. It also creates a log file in the sync folder that records the activities (files added and files overridden) performed on the sync folder.

Sample response:

{
      "data": {
            rejected_files": [],
            "sync_id": "SCM_FileSync_2024_07_04_07_18_20_2ZH7QY",
            "synced_files": [
                  "/home/opc/syncUtility/SCM_FileSync_2024_07_04_07_18_20_2ZH7QY/xxxxxxx.jpg",
                  "/home/opc/syncUtility/SCM_FileSync_2024_07_04_07_18_20_2ZH7QY/xxxxxxx.crt",
                  "/home/opc/syncUtility/SCM_FileSync_2024_07_04_07_18_20_2ZH7QY/xxxxxxx.ini",
                  "/home/opc/syncUtility/SCM_FileSync_2024_07_04_07_18_20_2ZH7QY/SCM_FileSync_2024_07_04_07_18_20_2ZH7QY_synclogs.txt"
            ]
      },
      "message": "All files successfully synced.",
      "status": "success",
}

Uploading Files to an Existing Sync Folder

You can upload new files to an existing sync folder or override existing files in the sync folder using the syncutilities/upload API.

To upload new files or override existing files in an existing sync folder using curl, call the syncutilities/upload API as follows:

curl -X PUT \
    --user "<username>:<password>" \
    --header 'Content-Type: multipart/form-data' \
    --form "file[]=@/path/to/xxxxxxxxx.crt" \
    --form "file[]=@/path/to/xxxxxxx.ini" \
    --url https:// <CM_instance_IP>:<port_num>/scm/api/v1.0/syncutilities/upload/<sync_id>

In the example:

  • user is the credentials (user name and password) for basic authentication.
  • Content-Type is the type of request content. The value of Content-Type must be multipart/form-data.
  • form is the file to add or override in an existing sync folder through the "file[]" key.
  • url is the PUT endpoint to upload new files or override existing files in an existing sync folder. Here, <sync_id> is the name of the sync folder that you want to update.

Sample response:

{
      "data": {
            "sync_id": "SCM_FileSync_2024_07_04_07_18_20_2ZH7QY",
            "synced_files": [
                  "/home/opc/syncUtility/SCM_FileSync_2024_07_04_07_18_20_2ZH7QY/xxxxxxx.crt",
                  "/home/opc/syncUtility/SCM_FileSync_2024_07_04_07_18_20_2ZH7QY/xxxxxxx.ini",
                  "/home/opc/syncUtility/SCM_FileSync_2024_07_04_07_18_20_2ZH7QY/SCM_FileSync_2024_07_04_07_18_20_2ZH7QY_synclogs.txt"
            ]
      },
      "message": "Sync folder updated successfully",
      "status": "success",
}

Retrieving Files and Directories in a Sync Folder

You can retrieve the list of files and directories in a sync folder using the syncutilities API.

To retrieve the list of files and directories in a sync folder using curl, call the syncutilities API as follows:

curl –X GET \
--user "<username>:<password>" \
-–url https://<CM_instance_IP>:<port_num>/scm/api/v1.0/syncutilities/<sync_id>

In the example:

  • user is the credentials (user name and password) for basic authentication.
  • url is the GET endpoint to retrieve the list of file and directories in a sync folder. Here, <sync_id> is the name of the sync folder of which you want to retrieve the list of files and directories.

Sample response:

{
      "data": { 
            "rejected_files": [],
            "sync_id": "SCM_FileSync_2024_07_04_07_18_20_2ZH7QY",
            "synced_files": [ 
                  "/home/opc/syncUtility/SCM_FileSync_2024_07_04_07_18_20_2ZH7QY/SCM_FileSync_2024_07_04_07_18_20_2ZH7QY_synclogs.txt",
                  "/home/opc/syncUtility/SCM_FileSync_2024_07_04_07_18_20_2ZH7QY/xxxxxxx.jpg",
                  "/home/opc/syncUtility/SCM_FileSync_2024_07_04_07_18_20_2ZH7QY/xxxxxxx.crt",
                  "/home/opc/syncUtility/SCM_FileSync_2024_07_04_07_18_20_2ZH7QY/xxxxxxx.ini"
            ] 
      }, 
      "message": "Synced Files successfully fetched", 
      "status": "success" 
}

Retrieving the List of Sync Folders

You can retrieve the list of all the sync folders using the syncutilities API.

To retrieve the list of all sync folders using curl, call the syncutilities API as follows:

curl –X GET \
--user "<username>:<password>" \
-–url https://<CM_instance_IP>:<port_num>/scm/api/v1.0/syncutilities
Note: Don't add a forward slash (/) at the end, it will make the endpoint invalid.

In the example:

  • user is the credentials (user name and password) for basic authentication.
  • url is the GET endpoint to retrieve the list all sync folders.

Sample response:

{ 
      "data": { 
            "sync_ids": [ 
                  "SCM_FileSync_2024_07_04_07_18_20_2ZH7QY", 
                  "SCM_FileSync_2024_07_05_04_17_07_4CXU2Q", 
                  "SCM_FileSync_2024_07_08_11_39_57_2ZQE3A"
             ]
       }, 
      "message": "Sync Folders successfully fetched.", 
      "status": "success" 
}

Deleting a Sync Folder

You can delete a sync folder using the syncutilities API. Deleting a sync folder permanently deletes the sync folder and all the files and directories in it.

To delete a sync folder with the files and directories in it, call the syncutilities API as follows:

curl –X DELETE \
--user "<username>:<password>" \
 	-–url https://<CM_instance_IP>:<port_num>/scm/api/v1.0/syncutilities/<sync_id>

In the example:

  • user is the credentials (user name and password) for basic authentication.
  • url is the DELETE endpoint to delete a sync folder. Here, <sync_id> is the name of the sync folder that you want to delete.

Sample response:

{ 
      "data": {}, 
      "message": "Sync folder deleted.", 
      "status": "success" 
}