Performing API Operations Using Bash
Applies to PeerGFS v6.1.0 and later
Overview
You can access and manage the PeerGFS API using Bash, which offers a flexible option for automation and integration into Unix-based workflows. This article explains how to use the provided Bash scripts, configure settings for convenience, and run examples to perform API operations. Whether you're customizing scripts or automating frequent tasks, these instructions will help you streamlinee your use of the PeerGFS API.
Running the Predefined Bash Script for API Operations
The predefined Bash script, PeerGFS-cli.sh
, simplifies common API operations by providing a ready-to-use interface for interacting with the PeerGFS API. The script eliminates the need to manually construct cURL commands, making it easier to automate tasks and ensure consistent execution across environments. The predefined Bash script is located in the installation directory <PMC Installation Directory>\\tools\\bash
, for both Windows and Linux deployments.
For PMC deployments on Windows, copy the bash
folder (with contents) to a Linux or macOS system. Ensure the script has executable permissions and is in Unix line-ending format:
Commands:
sudo chmod u+x PeerGFS-cli.sh
sudo dos2unix ./PeerGFS-cli.sh

The PeerGFS-cli.sh
script provides a user-friendly interface for running API operations using cURL
. You can also use cURL
directly in custom scripts. To generate the correct syntax for cURL
commands, you can use the API web interface.
Set Up Environment Variables
No configuration is required to run the PeerGFS-cli.sh
script or cURL
. However, for convenience, the examples in this section use environment variables. Set up environment variables for easier script access by creating a script such as PeerGFS-API-Setup.sh
. To set these variables in your environment, copy the script below, fill in the relevant parameters, then make it executable and run it in the same terminal session before executing the examples.
#! /bin/bash
export address=10.10.12.11
export port=8442
export username=admin
export password=password
To apply the environment variables to an existing session, use the .
or source
command:
Commands:
. ./PeerGFS-API-Setup.sh
echo $address
or
source ./PeerGFS-API-Setup.sh
echo $address

Bash Script Examples
This section illustrates how to use the PeerGFS-cli.sh
script to interact with the API from Bash. These examples can be customized to fit your workflow. To execute them:
Run the configuration script described earlier.
Copy and paste the provided commands into your terminal.
Show Available Commands
General Operations
Create a Job
Delete a Job
Start and Stop a Job
Release Quarantines
Notes for macOS users
Related articles
- Check .pc-trash_bin date stored times for target protection
- Creating a Job Using Bash Scripting
- Creating a Job Using PowerShell Scripting
- Creating a Job Using Scripting
- Does the EOA of NetApp ONTAPI impact PeerGFS?
- Generating Client Code for PeerGFS API with Swagger.io
- Getting Started with the PeerGFS REST API
- Performing API Operations Using Bash
- Performing API Operations Using cURL
- Performing API Operations Using PowerShell
- Scripting Methods for API Operations
- Use PowerShell to connect to the PeerGFS API