Using the Objects API to Create Users and Buckets

February 06, 2020

A coworker of mine, Laura Jordana recently sent me the API commands to create AMI Users and Buckets for Nutanix Objects using our API and I figured it was worth posting for posterity and my own reference in the future.

AMI Users

API Endpoint:

https://PRISMCENTRALIP:9440/oss/iam_proxy/buckets_access_keys

JSON for POST:

{
  "users": [
    {
      "type": "external",
      "username": "dheeraj@nutanix.com"
    }
  ]
}

Putting it all together:

curl -s -k -X POST https://PRISMCENTRALIP:9440/oss/iam_proxy/buckets_access_keys -H 'Content-Type: application/json' --user admin:'nutanix/4u' -d '
{
  "users": [
    {
      "type": "external",
      "username": "dheeraj@nutanix.com"
    }
  ]
}'

Buckets

This is a two parter. First, you need to get the Object Store UUID, then you POST the JSON to the API Endpoint.

Getting the Object Store UUID:

API Endpoint: ``

Example Curl command:

curl -X POST -d '{"entity_type":"objectstore"}'  -H 'Content-Type: application/json' http://PRISMCENTRALIP:7301/api/nutanix/v3/groups

The resulting JSON output will contain the Object Store UUID under entity_id.

{"entity_type":"objectstore","filtered_entity_count":1,"group_results":[{"entity_results":[{"entity_id":"b0681157-f537-41ed-57b3-4a2f9bb453ad"}],"total_entity_count":1}],"total_entity_count":1,"total_group_count":1}

Creating a Bucket:

API Endpoint:

https://PRISMCENTRALIP:9440/oss/api/nutanix/v3/objectstores/<object_store_uuid>/buckets

JSON for POST:

{
  "api_version": "3.0",
  "metadata": {
    "kind": "bucket"
  },
  "spec": {
    "name": "bucketnamehere",
    "description": "",
    "resources": {
      "features": [
        "VERSIONING"
      ]
    }
  }
}