Unit Measurement Conversion

FREEMIUM
By Pareto Co Ltd | Updated a month ago | Tools
Popularity

8.6 / 10

Latency

20,002ms

Service Level

99%

Health Check

N/A

README

Measurement Unit Conversion API

The Measurement Unit Conversion API allows you to convert values between different units of measurement. You can use this API to convert units for weight, length, area, volume, speed, fuel, pressure, and temperature.

Getting started

To use the API, you need to sign up for an API key. You can do this by visiting our website at https://rapidapi.com/rachellau/api/unit-measurement-conversion and subscribing to the API. Once you have subscribed, you will be given an API key that you can use to authenticate your requests.

Endpoints

The API has two endpoints:

  • /list: Returns a list of all available units for each measurement category.
  • /convert: Converts a value from one unit to another

/list endpoint

To use the /list endpoint, send a GET request to the endpoint URL (https://unit-measurement-conversion.p.rapidapi.com/list) with the API key and host headers included in the request. This will return a JSON object containing all the available units for each measurement category, along with their abbreviations (if available).

/convert endpoint

To use the /convert endpoint, send a GET request to the endpoint URL (https://unit-measurement-conversion.p.rapidapi.com/convert) with the following parameters in the request body as JSON data:

  • type: The type of measurement (e.g. weight, length, area, volume, speed, fuel, pressure, temperature).
  • fromUnit: The unit you want to convert from.
  • toUnit: The unit you want to convert to.
  • fromValue: The value you want to convert.

You will also need to include the API key and host headers in the request.

The API will then return a JSON object containing the converted value and the abbreviation of the unit (if available). The response will have the following format:

{
    "value": "<converted_value>",
    "abbreviation": "<unit_abbreviation>"
}

Example usage
Here is an example of using the API to convert 200 kilograms to pounds using JavaScript and the Axios library:

const axios = require('axios');

const options = {
  method: 'GET',
  url: 'https://unit-measurement-conversion.p.rapidapi.com/convert',
  params: {
    type: 'weight',
    fromUnit: 'pound',
    toUnit: 'kilogram',
    fromValue: '200'
  },
  headers: {
    'X-RapidAPI-Key': 'b03c3da6a6msh42c24597c1b5421p1078f3jsn162b153b89a9',
    'X-RapidAPI-Host': 'unit-measurement-conversion.p.rapidapi.com'
  }
};

try {
	const response = await axios.request(options);
	console.log(response.data);
} catch (error) {
	console.error(error);
}

This code sends a request to the /convert endpoint to convert 200 kilograms to pounds using your API key. The response from the API is then logged to the console as a string showing the converted value and its abbreviation.

Support
If you have any questions or need assistance, please contact our support team at info@paretoltd.com.

Followers: 1
API Creator:
Rapid account: Pareto Co Ltd
Pareto Co Ltd
rachellau
Log In to Rate API
Rating: 5 - Votes: 1