Sample request and response JSON payloads for the TollGuru Toll API and TollTally endpoints.
A comprehensive collection of API request/response examples for TollGuru's toll calculation services. This repository serves as a reference library for developers integrating with TollGuru APIs, providing ready-to-use JSON payloads for various use cases and parameter combinations.
- Static Content Repository: Contains JSON examples organized by API endpoint
- Utility Scripts: Python scripts for converting examples to cURL commands
- Documentation: Comprehensive examples and usage patterns
- No Running Services: Purely a reference repository with no deployed infrastructure
- External API Integration: Examples connect to TollGuru's cloud APIs
- Multi-Endpoint Coverage: Supports TollGuru and TollTally API endpoints
- Version Control: Git-based versioning for example updates
- Community Contributions: Open to external contributions and improvements
- Git for repository management
- Basic understanding of JSON and REST APIs
- Valid TollGuru API key (for testing examples)
- Python 3.x (for utility scripts)
- cURL or similar HTTP client tool
git clone https://github.com/mapup/tollguru-api-parameter-examples.git
cd tollguru-api-parameter-examplesNo additional setup required - this is a static repository of examples.
This repository does not contain automated tests. To validate examples:
# Test individual examples with cURL
curl -X POST <TOLLGURU_API_BASE_URL>/origin-destination-waypoints \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d @request-bodies/01-Origin-Destination-Cost-Tradeoff/01-address-as-string.json
# Validate JSON syntax
python -m json.tool request-bodies/01-Origin-Destination-Cost-Tradeoff/01-address-as-string.jsonThis repository does not require deployment as it contains static examples only. For distribution:
- GitHub Pages for documentation hosting (optional)
- npm package distribution (if packaged as library)
- Direct git clone for local usage
- API Configuration: Examples use placeholder API keys that must be replaced
- Base URLs: Defined in individual examples and utility scripts
- No Runtime Config: This is a static repository with no runtime configuration
- Examples use placeholder API keys that require replacement
- No automated validation against live API endpoints
- Limited to TollGuru API endpoints - not a general toll calculation library
- Examples may become outdated with API changes
- No error handling or retry logic in examples
- Utility scripts have basic functionality only
- Architecture Details: Technical architecture and system design
- Runbook: Operational procedures and troubleshooting guide
- API Documentation: Complete TollGuru API reference
- Project Description
- Repository Structure
- Endpoints
- Usage
- Contributing
- License
- Contact
- Additional Resources
This repository provides sample JSON request bodies and response payloads for the TollGuru Toll API. Use these examples as a reference when building integrations — each file demonstrates a specific parameter combination or feature of the API.
The examples cover three API endpoints across the TollGuru and TollTally product suite:
- Toll calculation via origin, destination, and waypoints (TollGuru)
- Toll calculation via complete polyline (TollTally)
- Toll calculation via GPS track CSV upload (TollTally)
For API authentication and full endpoint documentation, visit the TollGuru API Documentation.
.
├── request-bodies/ # Sample JSON request payloads, organized by endpoint
│ ├── 01-Origin-Destination-Cost-Tradeoff/
│ ├── 02-Complete-Polyline-To-Toll/
│ └── 03-TollTally-GPS-Tracks-To-Toll/
└── responses/ # Corresponding sample JSON responses
├── 01-Origin-Destination-Cost-Tradeoff/
├── 02-Complete-Polyline-To-Toll/
└── 03-TollTally-GPS-Tracks-To-Toll/
Endpoint: /origin-destination-waypoints
Calculates toll costs, route details, and fuel expenses by specifying an origin, destination, and optional waypoints.
Endpoint: /complete-polyline-from-mapping-service
Calculates toll costs and route details by providing a route's complete polyline as an encoded string or as decoded coordinates.
Endpoint: /gps-tracks-csv-upload
Calculates toll costs and route details from GPS points uploaded as a CSV file. Supports both synchronous (small files) and asynchronous (large files) uploads.
Clone the repository and use the JSON files directly as request bodies in your API calls.
git clone https://github.com/mapup/tollguru-api-parameter-examples.git
cd tollguru-api-parameter-examplescurl -X POST <TOLLGURU_API_BASE_URL>/origin-destination-waypoints \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d @request-bodies/01-Origin-Destination-Cost-Tradeoff/01-address-as-string.jsonThe request body used (01-address-as-string.json):
{
"from": {
"address": "Walt Whitman Brg Philadelphia, PA 19148, USA"
},
"to": {
"address": "Ocean City, NJ 08226 USA"
},
"vehicle": {
"type": "2AxlesAuto"
}
}Replace YOUR_API_KEY with your actual TollGuru API key and TOLLGURU_API_BASE_URL with the base URL from the API documentation.
For the /gps-tracks-csv-upload endpoint, parameters are sent as query parameters alongside the CSV file upload. Utility scripts are provided to help generate cURL commands from the sample JSON parameter files:
python request-bodies/03-TollTally-GPS-Tracks-To-Toll/scripts/convert_json_params_to_curl.py \
01-sync-upload-for-small-files.json out.txtWe welcome contributions to this repository! If you have suggestions or improvements, please open an issue or submit a pull request.
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch). - Make your changes.
- Commit your changes (
git commit -m 'Add new feature'). - Push to the branch (
git push origin feature-branch). - Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for more details.
For any questions or support, please reach out to api-support@tollguru.com.
For full API documentation, refer to: