Skip to main content

Create Container

This request creates a Container object.

post /storage/containers

Sample

A sample POST request to create a container:

curl -X POST \
'https://api.carrierx.com/core/v2/storage/containers' \
-H 'Content-Type: application/json' \
--data-binary '{}' \
-H 'Authorization: Bearer 5ebc03d6-8b2b-44ad-bf65-72d4f1491dda'

Response

200 status code with a serialized copy of the Container object:

{
"allow_publish": true,
"allowed_classifications": [],
"available_bytes_percent": 100,
"available_files_percent": 100,
"blocked_classifications": [],
"container_sid": "a291fe99-43d6-446f-a63e-91f93030dc7e",
"default_file_lifecycle_action": "no_action",
"default_file_lifecycle_ttl": -1,
"default_file_publish": "file_sid",
"default_file_threshold_include": true,
"default_file_unique": false,
"durability_class": "unassigned",
"encrypted": false,
"external_attributes": {},
"integer_key_1": null,
"integer_key_2": null,
"name": "N/A",
"parent_container_sid": null,
"partner_sid": "e00430c3-a7d0-4666-ab5c-f7202448382f",
"publish_domain": "https://storage.carrierx.com",
"quota_bytes": 1073741824,
"quota_files": 100,
"string_key_1": null,
"string_key_2": null,
"string_key_3": null,
"string_key_4": null,
"threshold_action": null,
"threshold_available_bytes_percent": null,
"threshold_available_files_percent": null,
"threshold_bytes": null,
"threshold_bytes_target": null,
"threshold_files": null,
"threshold_files_target": null,
"threshold_grace_period": 0,
"threshold_total_bytes": 0,
"threshold_total_files": 0,
"total_bytes": 0,
"total_files": 0,
"type": "internal",
"unique": false
}

Required Scopes

To create a Container object, the partner must have one of the following scopes enabled:

  • storage.manage
  • storage.create

Body Arguments

JSON representation of the fields and values of the Container object to be created.

No fields are required to create a container, an empty object can be passed.

Refer to this table to view all fields that appear in the Container object.

Responses

If the request is successful, a 200 response code will be returned with a serialized copy of the Container object.

Otherwise, if an error occurs, the system will return one of the HTTP errors used with CarrierX system.

Container Object Specific Errors

If you try to create a container with the unique attribute set to true and the container key set (integer_key_1, integer_key_2, string_key_1, string_key_2, string_key_3, and string_key_4), which has already been used with some other container, a 422 (object validation error) error will be returned. It has the following structure:

Response FieldData TypeDescription
fieldstringThe field that caused the error.
messagestringThe detailed error description.
reference_sidstringThe secure ID of the container, which has the same set of unique keys.

The returned error field value will be set to unique, and the message value will be set to container with the same set of keys already exists, indicating that you try to overwrite an existing unique container with the same container key set.

A sample container with the same set of keys already exists error:

{
"message":"object validation error",
"errors":[
{
"field":"unique",
"message":"container with the same set of keys already exists",
"reference_sid":"a291fe99-43d6-446f-a63e-91f93030dc7e"
}
]
}

To avoid this error, you can:

  • change the unique field for the container to be created to false;
  • change the key set for the container to be created, so that the created container was different from the existing one.