Put Object Meta Data
Using the following SDK method, you can add meta details for a particular object stored in a bucket in Stratus. The Object reference used in the below code snippet is the component instance.
The meta details will be passed as JSON key value pairs. For example, {“meta_key” : “meta_value”}
-
You can use alphanumeric, underscores, or whitespace characters, as well as hyphens, to write your metadata. No other special character is allowed other than the once mentioned.
-
You can fetch the metadata of an object using the HEAD request method. In the response, the metadata will be listed in the key ‘x-user-meta’.
-
The maximum size limit of characters allowed for the overall metadata is 2047 characters. The character count used to determine the size limit also includes the colon “:” special character used to define the key value pair.
Ensure the following packages are imported
copyimport org.json.simple.JSONObject; import java.util.HashMap;
copyHashMap<String, String> objectMeta = new HashMap<>(); objectMeta.put("key1", "value1"); objectMeta.put("key2", "value2"); JSONObject res = object.putMeta(objectMeta); System.out.println(res);
Example Response
copy{ "message": "Metadata added successfully" }
Last Updated 2025-05-30 16:54:59 +0530 +0530
Yes
No
Send your feedback to us