curl examples
This page explains AIStore HTTP and curl conventions through selected examples; it is not an exhaustive endpoint reference. For the current endpoint contract, use the generated OpenAPI reference. For application code, use the Go API or Python SDK.
Table of Contents
Notation
In this README:
G- denotes a (hostname:port) address of a gateway (any gateway in a given AIS cluster)
T- (hostname:port) of a storage target
G-or-T- a gateway or target address where direct access is permitted; see Node operations for target control requests.
Overview
AIStore supports a growing number and variety of RESTful operations. To illustrate common conventions, consider this gateway example:
This command queries the gateway’s own configuration. To select another node, use the gateway’s reverse endpoint as shown under Node operations. The response is JSON.
Notice the 6 (six) elements of a RESTful operation:
- Command line option or flag
The -X (or --request) and -L (--location) options are important. Run curl --help for help.
- HTTP verb (aka method):
PUT,GET,HEAD,POST,DELETE, orPATCH
For a brief summary of the standard HTTP verbs and their CRUD semantics, see REST API tutorial.
- Hostname (or IPv4 address) and TCP port of one of the AIStore daemons
Most RESTful operations performed on an AIStore proxy/gateway will likely have a clustered scope. Exceptions include querying proxy’s own configuration via ?what=config.
The default Local Playground gateway listens at
http://localhost:8080.
- URL path: version of the REST API, RESTful resource, and possibly more forward-slash delimited specifiers
For example: /v1/cluster where v1 is the API version and cluster is the resource. Resources include:
For the most recently updated URL paths, see:
- URL query, e.g.,
?what=config
All API requests that operate on a bucket carry the bucket’s specification in the URL query, including backend provider and namespace. An empty backend provider indicates an AIS bucket; an empty namespace translates as global (default) namespace.
- HTTP request and response headers
All supported query parameters and HTTP headers are enumerated in:
Easy URL
“Easy URL” is a simple alternative mapping of the AIS API to handle URL paths that look as follows:
- GET http(s)://host:port/provider/[bucket[/object]]
- PUT http(s)://host:port/provider/[bucket[/object]]
This enables convenient usage of your Internet Browser or curl. You can use simple intuitive URLs to execute GET, PUT, list-objects, and list-buckets.
AIS provides S3 compatibility via its
/s3endpoint. S3 compatibility shall not be confused with “easy URL” mapping.
For more details, see easy URL readme.
API Reference
For endpoint paths, parameters, and responses beyond these examples, refer to the generated HTTP API reference. The examples below demonstrate curl usage and do not enumerate the API.
For programmatic access:
- Go API - native Go client
- Python SDK - Python client
Probing liveness and readiness
Note:
http://localhost:8080address must be understood as a placeholder for an arbitrary AIStore endpoint (AIS_ENDPOINT).
Health probe during cluster startup:
The prr=true query parameter requests an additional check for whether the cluster is ready to rebalance upon membership changes.
External watchdogs use /v1/health?readiness=true for node readiness.
The apr, cii, and cii-apr query parameters belong to AIS’s internal bootstrap,
election, and peer-discovery protocol; they are not general-purpose health API options.
Internal startup polling combines apr=true with readiness=true to wait for the
primary to finish startup and for a target to consume the current cluster map.
Backend Provider
Any storage bucket that AIS handles may originate in a 3rd party Cloud, in another AIS cluster, or be created in AIS itself. To resolve naming and partition namespace with respect to both physical isolation and QoS, AIS introduces the concept of provider.
- Backend Provider - an abstraction that allows delineating between “remote” and “local” buckets.
Backend provider is an optional parameter across all AIStore APIs that handle access to user data and bucket configuration (GET, PUT, DELETE, and Range/List operations).
See also:
Curl Examples
Note: The examples below are provided for reference. For the most recently updated action names and message formats, see
api/apc. For authoritative API documentation, see HTTP API Reference.
Basic operations
Deprecated: native object HEAD v1. Omitting the
propsquery parameter selects the legacy response. Specify a nonemptypropsvalue for object HEAD v2, as in the examples above. This does not affect S3-compatible HEAD requests.
Listing
Cluster operations
Node operations
A gateway’s /v1/daemon endpoint queries that gateway. To select another node, use /v1/reverse/daemon with the Ais-Node-Id header. Replace NODE_ID below with the raw node ID from ais show cluster, without the t[...] or p[...] wrapper. When client authentication is required, also supply your bearer token in the Authorization header.
The reverse endpoint requires SHOW-CLUSTER permission for GET and ADMIN for PUT, POST, or DELETE when client authentication is enabled. See the Go API and CLI configuration commands for node updates.
Direct public target /v1/daemon requests permit only GET. They return 403 even for GET when either auth.client_auth_required or auth.intra_cluster.request_auth requires proxy mediation.
Bucket properties
Multi-object operations
Storage services
Object operations
Querying information
Queries use GET with ?what=<...>. The /v1/daemon examples below query the gateway itself. Use the reverse endpoint or CLI for a selected node.
Example: querying remote clusters
Example: querying node log
For a selected node, replace NODE_ID with an ID from ais show cluster. The CLI retrieves its log through the gateway instead of relying on direct public target access:
Example: cluster statistics
This causes an intra-cluster broadcast where the requesting proxy consolidates results from all nodes into a JSON output containing proxy and target request counters, per-target capacities, and more.
See Also
- HTTP API Reference - OpenAPI documentation
- AIS CLI - command-line interface
- Batch operations
- ETL