Use Case
In Oracle Cloud, Object Storage is often used as a staging area for ERP file processing, such as GL Extract, HCM Extract, or bulk data loads. However, once a file is processed successfully in ERP, it’s best practice to rename the file to avoid reprocessing or for better traceability.
For example, after a GL Extract File is loaded into ERP successfully, we want to rename it by adding a prefix such as Processed_
or appending a timestamp. This avoids confusion and maintains clear file lifecycle management.
Solution Steps
1. Object Storage REST API – renameObject
Oracle Object Storage provides a renameObject
action that allows you to rename an object within a bucket without re-uploading it.
API Endpoint Format:
POST /n/{namespaceName}/b/{bucketName}/actions/renameObject
Oracle Docs:
renameObject API – Oracle Cloud Infrastructure
2. Sample Request JSON
{
"sourceName": "SourceObjectName",
"newName": "TargetObjectName",
"srcObjIfMatchETag": "*",
"newObjIfMatchETag": "*",
"newObjIfNoneMatchETag": "*"
}
- sourceName → Current file name in the bucket.
- newName → New file name after rename.
*
in ETag fields ensures no version conflicts during rename.
3. Implementation in Oracle Integration (OIC)
Step 3.1 – Configure REST Invoke
- Name:
RenameGLExtractFile
- Method: POST
- Relative URI:
/n/{namespaceName}/b/{bucketName}/actions/renameObject
- Enable Add and review parameters & Configure request payload options.
Step 3.2 – Create Request Mapping
From the OIC mapping canvas:
- Map
sourceName
to the original filename variable (e.g.,glExtFileName
). - Map
newName
to the expression that generates the updated filename:concat(Var_PrefixTag_AddToFilename_FileUploaded, name)
- Set
srcObjIfMatchETag
,newObjIfMatchETag
, andnewObjIfNoneMatchETag
to"*"
.
Step 3.3 – Pass Template Parameters
- bucketName → OIC variable holding the target bucket name.
- namespaceName → OIC variable holding Object Storage namespace.
Step 3.4 – Test the Flow
Once the file is loaded successfully in ERP:
- Invoke the renameObject API via your configured REST connection.
- Verify in OCI Console → Object Storage → The file appears with the new name.
Example Scenario
- Before Rename:
GLExtract_20250804.txt
- After Rename:
Processed_GLExtract_20250804.txt
References
- Oracle Object Storage API: renameObject – OCI Documentation
- Oracle Integration Documentation: Working with REST Adapters in OIC
No comments:
Post a Comment