Table of ContentsView in Frames

Testing named data object storage and retrieval by using curl

You can store and retrieve a test named data object to ensure that these functions work.

Before you begin

Note: The use of named data objects is deprecated and no longer supported.

You must know the IP address and port number for an API Gateway Node or Storage Node.

About this task

You can connect client applications to an API Gateway Node or Storage Node. In the following steps, IP_address and port are for an API Gateway Node or Storage Node.

Note: If you copy a command from this section and paste the command into another application, the copy-and-paste process might remove dashes that appear between words near a line break. You must ensure that the pasted command includes all dashes before you run the command.

Steps

  1. From a client application, use curl to create a CDMI container object named MyContainer in the StorageGRID Webscale system: curl --request PUT --data-binary $'{}' --header 'Host: IP_address:port' --header 'Accept: application/cdmi-container' --header 'Content-Type: application/cdmi-container' --header 'X-CDMI-Specification-Version: 1.0.2' --insecure 'https://IP_address:port/CDMI/public/MyContainer/'
    A response similar to the following example appears:
    {"objectType":"application/cdmi-container",
    "objectID":"00006FFD001916010556DB52F71B474BBF9DE9A70932E7D83E",
    "objectName":"MyContainer/","parentURI":"/CDMI/public/",
    "parentID":"00006FFD0019A60C05737969D8A5B14FB8B233969393991C12",
    "domainURI":"/CDMI/cdmi_domains/",
    "capabilitiesURI":"/CDMI/cdmi_capabilities/container/public/all/",
    "completionStatus":"Complete","metadata":{},"childrenrange":"","children":[]}

    The response includes a "completionStatus":"Complete" text that indicates that you successfully created the data object. The response also includes the "objectID" number for the container object. In this example, "objectID" is 00006FFD001916010556DB52F71B474BBF9DE9A70932E7D83E.

  2. Use curl to create a named object in the previously created container object:curl --request PUT --data-binary $'{"metadata":{"colour":"Yellow"}, "mimetype":"text/plain; charset=utf-8", "valuetransferencoding":"utf-8", "value":"Hello"}' --header 'Host: IP_address:port' --header 'Accept: application/cdmi-object' --header 'Content-Type: application/cdmi-object' --header 'X-CDMI-Specification-Version: 1.0.2' --insecure 'https://IP_address:port/CDMI/public/MyContainer/MyDataObject'
    A response similar to the following example appears:
    {"capabilitiesURI":"/CDMI/cdmi_capabilities/dataobject/",
    "completionStatus":"Complete","domainURI":"/CDMI/cdmi_domains/",
    "mimetype":"text/plain; charset=utf-8",
    "objectID":"00006FFD0019F3E300433C836A6B5844E9BEA11129A84812F2",
    "objectName":"MyDataObject","objectType":"application/cdmi-object",
    "parentID":"00006FFD001916010556DB52F71B474BBF9DE9A70932E7D83E",
    "parentURI":"/CDMI/public/MyContainer/",
    "metadata":{"cdmi_atime":"2014-05-12T19:40:58.074672Z",
    "cdmi_ctime":"2014-05-12T19:40:58.074672Z","cdmi_data_redundancy_provided":"2",
    "cdmi_hash":"185F8DB32271FE25F561A6FC938B2E264306EC304EDA518007D1764826381969",
    "cdmi_immediate_redundancy_provided":"true","cdmi_size":"5",
    "cdmi_value_hash_provided":"SHA256","colour":"Yellow"}}

    The response includes "objectID" for the named object and a "parentID" for the container object.

  3. Use curl to retrieve the named data object created earlier: curl --request GET --header 'Host: IP_address:port' --header 'Accept: application/cdmi-object' --header 'X-CDMI-Specification-Version: 1.0.2' --insecure 'https://IP_address:port/CDMI/public/MyContainer/MyDataObject'
    A response similar to the following example appears:
    {"capabilitiesURI":"/CDMI/cdmi_capabilities/dataobject/",
    "completionStatus":"Complete","domainURI":"/CDMI/cdmi_domains/",
    "mimetype":"text/plain; charset=utf-8",
    "objectID":"00006FFD0019F3E300433C836A6B5844E9BEA11129A84812F2",
    "objectName":"MyDataObject","objectType":"application/cdmi-object",
    "parentID":"00006FFD001916010556DB52F71B474BBF9DE9A70932E7D83E",
    "parentURI":"/CDMI/public/MyContainer/","valuetransferencoding":"utf-8",
    "metadata":{"cdmi_atime":"2014-05-12T19:40:58.074672Z",
    "cdmi_ctime":"2014-05-12T19:40:58.074672Z",
    "cdmi_hash":"185F8DB32271FE25F561A6FC938B2E264306EC304EDA518007D1764826381969",
    "cdmi_size":"5","cdmi_value_hash_provided":"SHA256",
    "colour":"Yellow"},"valuerange":"0-4","value":"Hello"}
  4. Optional: Retrieve the value of a specific field by replacing /CDMI/public/MyContainer/MyDataObject with /CDMI/public/MyContainer/MyDataObject?field_name.
    The response includes the value for the requested field for the data object.
  5. Optional: Retrieve all metadata that begins with the prefix cdmi by replacing /CDMI/public/MyContainer/MyDataObject with /CDMI/public/MyContainer/MyDataObject?metadata:cdmi_.
    The response includes all metadata for the named data object that begins with the cdmi prefix.