Two methods are provided for testing the OpenAPI: cURL and Python.
[1] Testing with cURL
- Setup: To check if cURL is installed, open your Command Prompt or Terminal and type curl. If you receive an error stating that cURL is not found, follow the installation instructions available on the cURL GitHub repository.
- Making Your First OpenAPI Request: Open your Command Prompt/Terminal and use the following command. Replace yyyy-MM-dd with a date within the past 31 days (excluding the current date) using the yyyy-mm-dd format. mydir with your actual download folder path on your computer.
macOS
curl -X POST \
https://secureporter.cloudcnm.zyxel.com/open-api/v1/archive-logs/download \
-H "Content-Type: application/json" \
-H "X-Authorization: Bearer $OPEN_API_TOKEN" \
-d "{\"device_date\":\"yyyy-MM-dd\"}" \
-o mydir/archive.tar
Windows
curl -X POST ^
https://secureporter.cloudcnm.zyxel.com/open-api/v1/archive-logs/download ^
-H "Content-Type: application/json" ^
-H "X-Authorization: Bearer %OPEN_API_TOKEN%" ^
-d "{\"device_date\":\"yyyy-MM-dd\"}" ^
-o mydir\archive.tar
Replace "https://api.example.com/endpoint" with the actual API endpoint and "your_api_token" with your API token.
[2] Testing with Python
- Verify Python Installation: To check if Python is installed, open your Command Prompt or Terminal and type ‘python’. If you receive an error stating that Python is not found, you can install it by following the instructions available on the official Python website. Ensure you have Python 3.8 or newer installed to use the Requests library.
- Create and Activate a Virtual Environment:
Create a Project Directory and Virtual Environment: Follow the official Python venv documentation to create your virtual environment in a project directory.
macOS
source your-virtual-environment-path/bin/activate
Windows
your-virtual-environment-path\Scripts\activate
Replace your-virtual-environment-path with the actual path to your virtual environment directory.