Reputation: 1
Is there any API available in OCI to update an existing object in the bucket. Or can you please suggest any other alternative to this? I'm looking for a way to update the existing file.
Upvotes: 0
Views: 568
Reputation: 2540
Since you are trying to append additional content to an uploaded object, you would need to download the existing object using the GetObject API, append to the downloaded content locally, and then upload that original+appended content back to object storage using the PutObject API.
Upvotes: 0
Reputation: 470
As I said in the comments, Can you try using object versioning.
To enable object versioning after bucket creation
oci os bucket update --namespace <object_storage_namespace> --name <bucket_name> --compartment-id <target_compartment_id> --versioning Enabled
To list object versions
oci os object list-object-versions --namespace <object_storage_namespace> --bucket-name <bucket_name>
To get the contents of an object version
oci os object get --name <object_name> --file path/to/file/name --version-id <version_identifier> --namespace <object_storage_namespace> --bucket-name <bucket_name>
To delete an object version
oci os object delete --name <object_name> --version-id <version_identifier> --namespace <object_storage_namespace> --bucket-name <bucket_name>
to load continue to use oci os object put
More in the documentation https://docs.oracle.com/en-us/iaas/Content/Object/Tasks/usingversioning.htm. You can find also the way to do using the API or the SDK
Upvotes: 1