Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

This article provides comprehensive instructions for using curl commands to interact with SWARM Storage. Commands are organized into categories for creating and managing domains, buckets, objects, and configurations. Replace placeholder terms like hostname and domain with your actual values when executing these commands.


1. Creating Domains and Buckets

Create a Domain

To create a new domain in SWARM Storage, use the following command:

curl -i --location-trusted --post301 --data-binary "" "http://hostname/api?domain=yourDomainName&createdomain"
  • Purpose: Initializes a new domain.

  • Notes: Replace yourDomainName with the desired domain name.

Create a Bucket

To create a bucket within a specified domain, use this command:

curl -i --location-trusted --post301 -XPOST --data-binary "" "http://hostname/api/testbucket?domain=yourDomainName"
  • Purpose: Sets up a new bucket within the specified domain.

  • Notes: Replace yourDomainName with the appropriate domain and testbucket with the bucket name.


2. Uploading Objects

Upload Multiple Objects

To upload multiple objects to a bucket, use the following loop:

for i in {1..10}; do curl -i --location-trusted -XPOST --post301 --data-binary @yourFileName "http://hostname/api/testbucket/NamedObject-$i.txt?domain=yourDomainName" -u "admin:admin"; done
  • Purpose: Uploads multiple objects to a bucket.

  • Notes: Replace yourFileName with the file you are uploading, and yourDomainName with the domain. Adjust the number of iterations ({1..10}) as needed.

Upload a Single Object

To upload a single object:

curl -i --location-trusted --post301 -XPOST --data-binary @yourFileName "http://hostname/api/testbucket/NamedObject.txt?domain=yourDomainName"
  • Purpose: Uploads a single object to a bucket.

  • Notes: Replace yourFileName with the file you are uploading, and yourDomainName with the domain.


3. Setting Cluster and Node Configurations

Update Cluster Setting

To update a cluster setting, such as erasure coding conversion percentage:

curl -X PUT --header "Content-Type: application/json" --header "Accept: text/plain" -d "{}" "http://hostname:port/api/storage/clusters/_self/settings/ec.conversionPercentage?value=40" --digest -u "admin:password"
  • Purpose: Adjusts the erasure coding conversion percentage.

  • Notes: Replace 40 with the desired percentage, and hostname:port with your cluster's address.

Set Node Setting

To update node-level settings, such as health limits:

curl -i --location-trusted -X PUT --header "Content-Type: application/json" --header "Accept: text/plain" -d "{}" "http://hostname:port/api/storage/nodes/_self/settings/health.neonatalAgeLimit?value=30" -u "admin:password"
  • Purpose: Configures node settings.

  • Notes: Replace 30 with the desired limit, and hostname:port with the node's address.


4. Managing Objects and Domains

Enable Policy Versioning on a Domain

To enable policy versioning on a domain:

curl -i --location-trusted -XPUT --post301 --data-binary '' -H "Policy-Versioning: enabled" "http://hostname/api?domain=yourDomainName&replicate=immediate&admin" -u "admin:password"
  • Purpose: Activates policy versioning for the domain.

  • Notes: Replace yourDomainName with the target domain.

Check Object Integrity

To check the integrity of an object:

curl -i --location-trusted "http://hostname/api/testbucket/ObjectName.txt?domain=yourDomainName&checkintegrity"
  • Purpose: Verifies the integrity of the specified object.

  • Notes: Replace ObjectName.txt with the object's name, and yourDomainName with the domain.

Capture Manifest of a Version

To capture the manifest of a specific version:

curl -i --location-trusted "http://hostname/api/testbucket/ObjectName.txt?domain=yourDomainName&readmanifest&version=versionID"
  • Purpose: Retrieves the manifest for a specified version of an object.

  • Notes: Replace versionID with the version identifier.

List All Information of an EC Object

To list detailed information about an erasure-coded object:

curl -i --location-trusted "http://hostname/api/testbucket?domain=yourDomainName&format=json&name=ObjectName.txt&versions&field=all"
  • Purpose: Provides comprehensive details about an erasure-coded object.

  • Notes: Replace ObjectName.txt with the object's name, and yourDomainName with the domain.


5. Additional Operations

Change Admin Password

To change the admin password:

curl -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' 'http://hostname:port/api/storage/clusters/_self/administrators/admin?password=newPassword' -u admin:oldPassword
  • Purpose: Updates the admin password for the cluster.

  • Notes: Replace newPassword and oldPassword with the appropriate values.

Set Lifepoint

To set the lifepoint for an object:

curl -v --post301 -XPOST -H 'Content-type: text/html' -H 'lifepoint: [Date] reps=2, deletable=False, [] delete' --location-trusted http://hostname/api/bucket/lifePointObject?domain=yourDomainName
  • Purpose: Configures the lifepoint for a specific object.

  • Notes: Replace [Date] with the desired date and yourDomainName with the domain.

Delete a Bucket

To delete a bucket and its contents:

curl -i --location-trusted -XDELETE "http://hostname/api/testbucket?domain=yourDomainName&recursive=now"
  • Purpose: Removes the specified bucket and all contained objects.

  • Notes: Replace yourDomainName with the domain.

Create an EC Object

To create an erasure-coded object:

curl -i --location-trusted --post301 --data-binary @yourFileName "http://hostname/api/testbucket/ec-named-1.txt?domain=yourDomainName&erasurecoded=yes&encoding=2:2"
  • Purpose: Creates an erasure-coded object with the specified encoding.

  • Notes: Replace yourFileName with the file to be used and yourDomainName with the domain.


General Tips

  • Replace Placeholders: Always replace hostname, domain, yourFileName, and other placeholders with actual values relevant to your environment.

  • Permissions: Ensure you have the necessary permissions for performing these operations.

  • Security: Use secure methods for handling sensitive information like passwords.

This document provides a structured approach to managing SWARM Storage using curl commands. For further details or troubleshooting, refer to the SWARM Storage documentation or your internal support resources.


  • No labels