Giter Site home page Giter Site logo

mapup / tollguru-api-parameter-examples Goto Github PK

View Code? Open in Web Editor NEW
0.0 4.0 0.0 589 KB

This repo lists request parameters and corresponding JSON to use with the TollGuru Toll API to receive specific responses.

Home Page: https://tollguru.com/toll-api-docs

Python 44.21% JavaScript 55.79%
fuel-calculator-service gps-tracking route-optimization toll-api toll-calculator tollguru trip-planner

tollguru-api-parameter-examples's Introduction

TollGuru API Parameter Examples

This repository provides examples of how to interact with the TollGuru API. The TollGuru API offers a comprehensive suite of tools for calculating toll costs for various routes and vehicles, providing accurate and efficient toll pricing information. This guide will help you understand how to use the provided examples to integrate toll calculations into your applications.

Table of Contents

Project Description

The TollGuru API allows developers to calculate toll costs for different routes based on vehicle parameters and toll policies. This API is useful for various applications, including fleet management, trip planning, and logistics. With support for different vehicle types and configurations, the API provides flexible and accurate toll calculation.

Key features include:

  • Route Calculation: Determine toll costs for specified routes.
  • Vehicle Parameterization: Customize calculations based on vehicle type, fuel cost, tag cost, and more.
  • Multi-Route Support: Compare toll costs for multiple routes to find the most cost-effective path.

For a comprehensive overview of the TollGuru API, please visit the TollGuru API Documentation.

Installation

To use the examples in this repository, clone the repo to your local machine and install the necessary dependencies.

git clone https://github.com/mapup/tollguru-api-parameter-examples.git
cd tollguru-api-parameter-examples
npm install

Usage

The repository includes several example scripts that demonstrate how to interact with the TollGuru API. Each example showcases different functionalities of the API.

Example: Calculate Toll Costs

const axios = require('axios');

const calculateToll = async () => {
  const response = await axios.post('https://api.tollguru.com/v1/calc/route', {
    source: {
      lat: 37.7749,
      lng: -122.4194
    },
    destination: {
      lat: 34.0522,
      lng: -118.2437
    },
    vehicleType: "2AxlesAuto",
    departure_time: "2023-08-01T12:00:00Z"
  }, {
    headers: {
      'Content-Type': 'application/json',
      'x-api-key': 'YOUR_API_KEY'
    }
  });

  console.log(response.data);
};

calculateToll();

Replace 'YOUR_API_KEY' with your actual API key. This example demonstrates how to calculate toll costs for a route between San Francisco and Los Angeles for a 2-axle automobile.

Example: Vehicle Parameters

const axios = require('axios');

const getVehicleParameters = async () => {
  const response = await axios.get('https://api.tollguru.com/v1/vehicle-types', {
    headers: {
      'Content-Type': 'application/json',
      'x-api-key': 'YOUR_API_KEY'
    }
  });

  console.log(response.data);
};

getVehicleParameters();

Example: Route Preferences

const axios = require('axios');

const calculatePreferredRoute = async () => {
  const response = await axios.post('https://api.tollguru.com/v1/calc/route', {
    source: {
      lat: 40.7128,
      lng: -74.0060
    },
    destination: {
      lat: 34.0522,
      lng: -118.2437
    },
    vehicleType: "2AxlesAuto",
    departure_time: "2023-08-01T12:00:00Z",
    preferred_routes: ["fastest", "shortest"]
  }, {
    headers: {
      'Content-Type': 'application/json',
      'x-api-key': 'YOUR_API_KEY'
    }
  });

  console.log(response.data);
};

calculatePreferredRoute();

Contributing

We welcome contributions to this repository! If you have suggestions or improvements, please open an issue or submit a pull request.

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Make your changes.
  4. Commit your changes (git commit -m 'Add new feature').
  5. Push to the branch (git push origin feature-branch).
  6. Open a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Contact

For any questions or support, please reach out to [email protected].

Additional Resources

For a comprehensive overview and additional details, refer to the following sections of the TollGuru API Documentation:

tollguru-api-parameter-examples's People

Contributors

maneesh-mapup avatar paras-kanwar-mapup avatar saifuddin-ahmed-mapup avatar vishalbd avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.