Executing the File Upload Automation Script

File Upload Automation script assists you to upload the files seamlessly.

Complete the following procedure to execute the fileupload automation script.
Python 3.10 is required to access data elements from the API JSON responses.
  1. Extract the FILEUPLOAD_UTIL.zip file located in the $HOME directory.
  2. Copy the Data Loader input file to the $HOME/FILEUPLOAD_UTIL directory.

    Figure 4-1 Data Loader Input File Location Path


    This image displays the path where the Data Loader Input file is stored.

  3. Edit the script Env_setup.sh file to update the following environment variables.
    • IDCS URL - The Service Instance URL to access your IDCS console.

      You can get the IDCS URL from the following menu:

      Oracle Cloud Infrastructure Console > Identity Cloud.

      Syntax: <idcs-url>/oauth2/v1/token

    • Encoded - The <OAuth Client ID>:<OAuth Client Secret> encoded using base64encode

      To extract and encode the Client ID and Client Secret, refer to the following steps:

      1. Login to Admin Console.
      2. Go to System Configuration tab, and click Component Details tile.
      3. Click OAUTH Creds tab to view and copy the OAUTH Client ID and OAUTH Client Secret details.
      4. Using any base64encode utility, encode <OAUTH Client ID>:<OAUTH Client Secret>.

        Example (Input OAUTH Client ID and Client Secret):

        ftptenant-prd_APPID:99140e14-4d30-4e86-85fb-09501fe45fe0

        Example (Encoded OAUTH Client ID and Client Secret): ZnRwcWExMDEyMzEtcHJkX0FQUElEOjBkMmU5MDBiLTlhYjItNGFmOS05OWM0LTEwNTYyMDVkYWYwNQ==

    • Username - The Username to access the application.

      Note:

      The user should have appropriate roles and privileges. For more information about roles and priveleges, refer to Roles and Functions.
    • Password - The password to login to the application.
    • Tenant - The tenant associated with the application.
    • PBSM Host - Details of the PBSM host on which the application is hosted.
      Sample Env_setup.sh
      IDCS_URL=https://idcs-xyz123.identity.c9xyz.oc9xyz.com/oauth2/v1/token
      ENCODED=ZnRwbWFydXAxNDIyMzEtcHJkX0FQUElEOjk5MTQwZTE0LTRkMzAtNGU4Ni04NWZiLTA5NTAxZmU0NWZlMA==
      USERNAME=<user_name>
      PASSWORD=<password>
      TENANT=<tenant-prd>
      PBSMHOST=dc.pbsmcloud.us-xxxxx -1.ocs.oc-test.com
  4. Execute PBSMCS_PAR_fileupload.sh with the following parameters –
    • filename - The file to be uploaded
    • filesize - The file size in Bytes
    • Mimetype - The mimetype of the file.

    Format: Filename<space>Filesize<space>mimetype

    Example: ./PBSMCS_PAR_fileupload.sh input_20150101_filename_example_8007.txt 334 text/plain

    This script generates the access token and the PAR URL. It also uploads the file into the object store and scans the file too.

    Note:

    To upload multiple files, you must execute the script for each file, separately.

    Once the script is executed succesfully, the file is uploaded and added to the list of files in the File Upload/Download page. To access the File Upload/Download page refer to Upload or Download File from Object Store Using Console.