Code Examples
Examples of requests using our API endpoints
Get API token from Developer token
Javascript
const axios = require('axios');
async function fetchData() {
try {
const response = await axios.get('https://app.2050-materials.come/developer/api/getapitoken', {
headers: {
'Access-Control-Allow-Origin': '*',
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_TOKEN',
},
mode: 'no-cors'
});
console.log(response.data);
} catch (error) {
console.error('Error fetching data: ', error);
}
}
fetchData();Python
Get building board products with an EPD
Step 1: Render filters and create dictionaries for filtering
Limited data: /get_products_open_api
Expanded data: /get_products
Generic Data: /get_generic_materials
Retrieve Warming Potential and EC for a High-Rise Residential building /get_co2_warming_potential
Flow to retrieve tokens, get filters, and render building boards with EPDs in Canada.
Step 1: Obtain Bearer Token
Step 2: Get Filters and Create Dictionaries for Product Types, Material Types, and Certificate Types
Step 3: Use Filters to Call get_products API and Create DataFrame
get_products API and Create DataFrameNotes:
Last updated
Was this helpful?