RESTful API Reference
It's wonderful to know that you're interested in Consupedia's RESTful API. This guide will provide you with an overview of the fundamental steps needed to begin utilizing the API, allowing you to access sustainability data for a wide range of food products.
Contact tech-support@consupedia.com to obtain an API-key.
Authorization
To authorize your requests, you'll need to use an API key. The key should be included in the header of your requests as follows:
Header:
Key: X-API-KEY
Value: [your_api_key]
To make a sample cURL request using the provided authorization, replace [your_api_key] with your actual API key:
cURL example
curl -X GET 'https://connect.consupedia.com/api/v2/...' -H 'X-API-KEY: your_api_key'Python example
import requests
url = 'https://connect.consupedia.com/api/v2/...'
headers = {
'X-API-KEY': 'your_api_key'
}
response = requests.get(url, headers=headers)
Javascript example
const axios = require('axios');
const url = 'https://connect.consupedia.com/api/v2/...';
const headers = {
'X-API-KEY': 'your_api_key'
};
axios.get(url, { headers })
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});Connect API
Connect API is our RESTful service for subscribing and querying sustainability data for specific products. Subscriptions can be used together with our webhook service.
Uses cases:
- Enterprise data enrichment
- Producer sustainability tracking
Base url: https://connect.consupedia.com/api/v2/See documentation. Product API
Product API is our RESTful service for querying general information as well as sustainability parameters about products. It is not for commercial use and is aimed at research projects.
Contact us for more information.
Base url: https://api.consupedia.com/v3/See documentation here.