Integrate EazyUnit's powerful conversion functionality into your applications with our REST API.
The EazyUnit API provides programmatic access to our comprehensive unit conversion system. You can integrate our conversion capabilities into your own applications, websites, or services.
Our API follows REST principles, uses JSON for data interchange, and employs standard HTTP response codes.
https://api.eazyunit.com/v1Your API key should be included in the header of all requests:
X-API-Key: your_api_key_hereKeep your API key secure and don't expose it in client-side code.
Successful responses include:
{
"value": 10,
"from": "meter",
"to": "foot"
}{
"success": true,
"result": {
"value": 32.8084,
"unit": "foot",
"from": {
"value": 10,
"unit": "meter"
},
"formula": "1 meter = 3.28084 feet"
}
}// Convert 10 meters to feet
const apiKey = 'your_api_key_here';
const endpoint = 'https://api.eazyunit.com/v1/convert';
fetch(endpoint, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': apiKey
},
body: JSON.stringify({
value: 10,
from: 'meter',
to: 'foot'
})
})
.then(response => response.json())
.then(data => {
if (data.success) {
console.log(`Result: ${data.result.value} ${data.result.unit}`);
} else {
console.error('Conversion failed:', data.error);
}
})
.catch(error => {
console.error('API request failed:', error);
});