API Documentation

This document provides an overview of the Extra Virgin Vault API endpoints for accessing olive oil data.

Base URL

All API endpoints are available at: https://www.extravirginvault.com/api/

API Versions

Version 1 (v1)

Returns data in JSON object format with named fields.

Version 2 (v2)

Returns data in optimised array format for better performance and smaller payload sizes.

Available Endpoints

API v1 Endpoints

GET /api/v1/oils.json

Returns a list of all olive oils with detailed information.

Response Format: Array of objects Fields:

GET /api/v1/producers.json

Returns a list of all olive oil producers.

Response Format: Array of objects Fields:

GET /api/v1/regions.json

Returns a list of all production regions.

Response Format: Array of objects Fields:

GET /api/v1/varieties.json

Returns a list of all olive varieties.

Response Format: Array of objects Fields:

API v2 Endpoints

GET /api/v2/oils.json

Returns olive oil data in optimised array format for better performance.

Response Format: Object with fields and data arrays

Example Response Structure:

{
  "fields": ["title", "url", "country", "year", "region", "phenols", ...],
  "data": [
    ["Oil Name 1", "/oils/oil-1/", "Australia", 2024, "Region 1", 250, ...],
    ["Oil Name 2", "/oils/oil-2/", "New Zealand", 2024, "Region 2", 300, ...]
  ]
}

Usage Examples

Fetching All Oils (v1)

fetch('/api/v1/oils.json')
  .then(response => response.json())
  .then(oils => {
    oils.forEach(oil => {
      console.log(`${oil.title} - ${oil.trust_level} trust`);
    });
  });

Fetching All Oils (v2 - Optimised)

fetch('/api/v2/oils.json')
  .then(response => response.json())
  .then(result => {
    const { fields, data } = result;
    const titleIndex = fields.indexOf('title');
    const trustIndex = fields.indexOf('trust_level');
    
    data.forEach(oil => {
      console.log(`${oil[titleIndex]} - ${oil[trustIndex]} trust`);
    });
  });

Fetching Producers

fetch('/api/v1/producers.json')
  .then(response => response.json())
  .then(producers => {
    producers.forEach(producer => {
      console.log(`${producer.name} - ${producer.oil_count} oils`);
    });
  });

Data Notes

Rate Limiting

Currently, no rate limiting is applied to these endpoints. However, please be respectful with your usage.

Support

For questions about the API or to report issues, please contact us.