How to Unzip Files with cURL

Learn how to use the pdfRest Zip Files API Tool with cURL to unzip files from .zip archives.
Share this page

Why Unzip Files with cURL?

The pdfRest Zip Files API Tool offers a convenient solution for handling zip files programmatically. By utilizing this tool, developers can automate the process of unzipping files directly from their applications. This tutorial demonstrates how to send an API call to unzip files using cURL, a command-line tool for transferring data with URLs.

In many scenarios, unzipping files is essential, particularly when processing large datasets or multiple files compressed for easier transfer. For example, a user might start with a zip file containing multiple PDFs that need to be extracted and processed individually with pdfRest. Automating this process with the pdfRest API saves time and reduces the potential for errors, enhancing workflow efficiency.

Unzip Files with cURL Code Example

curl -X POST "https://api.pdfrest.com/unzip" \
  -H "accept: application/json" \
  -H "apikey: YOUR_API_KEY" \
  -F "file=@path/to/your/file.zip"

Source: GitHub Repository

Breaking Down the Code

The provided cURL command is a POST request to the pdfRest API endpoint https://api.pdfrest.com/unzip. The purpose of this request is to unzip a file using the API.

-X POST "https://api.pdfrest.com/unzip"

This specifies the API endpoint and the HTTP method (POST) used to send the request.

-H "accept: application/json"

This header indicates that the client expects the server to return data in JSON format.

-H "apikey: YOUR_API_KEY"

The apikey header is used to authenticate the request. Replace YOUR_API_KEY with your actual API key obtained from pdfRest.

-F "file=@path/to/your/file.zip"

The -F flag is used to specify the file to be uploaded. The @ symbol indicates that the file is being uploaded from the local filesystem. Replace path/to/your/file.zip with the actual path to the zip file you wish to unzip.

Beyond the Tutorial

In this tutorial, you learned how to use cURL to send an API request to the pdfRest Zip Files API to unzip a file. This process can be integrated into larger workflows to automate file handling tasks.

To explore more functionalities offered by pdfRest, try the various API tools available in the API Lab. For more detailed information, refer to the API Reference Guide.

Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at GitHub Repository.

Generate a self-service API Key now!

Create your FREE API Key to start processing PDFs in seconds, only possible with pdfRest.

Compare Plans
Contact Us