Datneat API Examples
These example scripts demonstrate how to use the Datneat API from different programming languages and environments.
For detailed documentation, visit the API Channels page and click "API Docs" on any channel.
Available Examples
File | Description | Action |
---|
Format Conversion Examples
Our example scripts include specialized tools for converting between file formats. These tools demonstrate the format conversion capabilities of the Datneat API.
Python Format Converter
The
format_converter.py
script provides a
specialized tool for format conversion:
# Basic usage - convert CSV to JSON python format_converter.py --api-url https://api.datneat.com/api \ --api-key YOUR_API_KEY \ --input sample_data.csv \ --format json # Convert with data cleaning python format_converter.py --api-url https://api.datneat.com/api \ --api-key YOUR_API_KEY \ --channel-id YOUR_CHANNEL_ID \ --input sample_data.csv \ --format xml \ --clean \ --instructions "Standardize country names and fix dates" # Batch process multiple files python format_converter.py --api-url https://api.datneat.com/api \ --api-key YOUR_API_KEY \ --input ./data_directory \ --format xlsx \ --batch \ --pattern "*.csv"
Bash Script (cURL)
The
convert.sh
script demonstrates format
conversion using cURL:
# Make the script executable chmod +x convert.sh # Basic usage ./convert.sh -i sample_data.csv -f json -k YOUR_API_KEY # With cleaning instructions ./convert.sh -i sample_data.csv -f xml -k YOUR_API_KEY -c YOUR_CHANNEL_ID \ -x "Fix dates and standardize country names"
Complete Workflow Example
The
complete_workflow.py
script demonstrates the
complete API workflow, including downloading in multiple
formats:
# Update API_KEY and CHANNEL_ID in the script first python complete_workflow.py sample_data.csv
Supported Formats
The Datneat API supports the following formats for conversion:
Format | URL Parameter | Description |
---|---|---|
CSV | ?format=csv |
Comma-separated values, ideal for spreadsheets and data analysis tools |
Excel | ?format=xlsx |
Microsoft Excel format, opens directly in Excel |
JSON | ?format=json |
JavaScript Object Notation, ideal for web applications and API integrations |
XML | ?format=xml |
Extensible Markup Language, structured format widely used in enterprise systems |
Getting Started
To use these examples, you'll need:
- A Datneat account with an API key
- An API channel ID (created in the Datneat dashboard or via API)
-
Required dependencies:
- Python 3.6+ and the requests library for Python examples
- Bash with cURL for shell script examples
Tip: You can find your API key and channel ID in
the dashboard.