curl --request POST \
--url https://app.variable.global/api/v1/dataset \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Product Name",
"description": "A descriptive description",
"notes": "Internal notes about this product",
"sku": "SKU123",
"syncId": "sync123",
"cpcCode": "CPC123",
"supplierPartId": "PART-123",
"unit": "kg",
"weight": {
"quantity": 100,
"unit": "kg"
},
"packagingWeight": {
"quantity": 10,
"unit": "kg"
},
"recycledPercent": 30,
"footprint": {
"CO2e": {
"A1": "1200.0",
"A2": "30.0",
"A3": "4.0",
"A4": "0.5",
"B1": "0.06",
"B2": "0.007",
"B3": "0.0008",
"B4": "",
"B5": "",
"C1": "",
"C2": "",
"C3": "",
"C4": "",
"D": ""
}
},
"dataQualityIndicators": {
"description": "Primary data from the 2022 production year; background datasets from ecoinvent 3.9.",
"documentationYear": 2019,
"coveragePercent": 80,
"specificPercent": 40,
"technologicalDQR": 1,
"temporalDQR": 1,
"geographicalDQR": 1,
"completenessDQR": 1,
"reliabilityDQR": 1
},
"taxonomy": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Material",
"path": "material"
},
"geoLocation": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Pittsburgh, PA"
},
"location": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Pittsburgh Office"
},
"startDate": "2021-01-01T00:00:00.000Z",
"endDate": "2021-01-01T00:00:00.000Z"
}
'import requests
url = "https://app.variable.global/api/v1/dataset"
payload = {
"name": "Product Name",
"description": "A descriptive description",
"notes": "Internal notes about this product",
"sku": "SKU123",
"syncId": "sync123",
"cpcCode": "CPC123",
"supplierPartId": "PART-123",
"unit": "kg",
"weight": {
"quantity": 100,
"unit": "kg"
},
"packagingWeight": {
"quantity": 10,
"unit": "kg"
},
"recycledPercent": 30,
"footprint": { "CO2e": {
"A1": "1200.0",
"A2": "30.0",
"A3": "4.0",
"A4": "0.5",
"B1": "0.06",
"B2": "0.007",
"B3": "0.0008",
"B4": "",
"B5": "",
"C1": "",
"C2": "",
"C3": "",
"C4": "",
"D": ""
} },
"dataQualityIndicators": {
"description": "Primary data from the 2022 production year; background datasets from ecoinvent 3.9.",
"documentationYear": 2019,
"coveragePercent": 80,
"specificPercent": 40,
"technologicalDQR": 1,
"temporalDQR": 1,
"geographicalDQR": 1,
"completenessDQR": 1,
"reliabilityDQR": 1
},
"taxonomy": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Material",
"path": "material"
},
"geoLocation": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Pittsburgh, PA"
},
"location": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Pittsburgh Office"
},
"startDate": "2021-01-01T00:00:00.000Z",
"endDate": "2021-01-01T00:00:00.000Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Product Name',
description: 'A descriptive description',
notes: 'Internal notes about this product',
sku: 'SKU123',
syncId: 'sync123',
cpcCode: 'CPC123',
supplierPartId: 'PART-123',
unit: 'kg',
weight: {quantity: 100, unit: 'kg'},
packagingWeight: {quantity: 10, unit: 'kg'},
recycledPercent: 30,
footprint: {
CO2e: {
A1: '1200.0',
A2: '30.0',
A3: '4.0',
A4: '0.5',
B1: '0.06',
B2: '0.007',
B3: '0.0008',
B4: '',
B5: '',
C1: '',
C2: '',
C3: '',
C4: '',
D: ''
}
},
dataQualityIndicators: {
description: 'Primary data from the 2022 production year; background datasets from ecoinvent 3.9.',
documentationYear: 2019,
coveragePercent: 80,
specificPercent: 40,
technologicalDQR: 1,
temporalDQR: 1,
geographicalDQR: 1,
completenessDQR: 1,
reliabilityDQR: 1
},
taxonomy: {
uuid: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
name: 'Material',
path: 'material'
},
geoLocation: {uuid: '3c90c3cc-0d44-4b50-8888-8dd25736052a', name: 'Pittsburgh, PA'},
location: {uuid: '3c90c3cc-0d44-4b50-8888-8dd25736052a', name: 'Pittsburgh Office'},
startDate: '2021-01-01T00:00:00.000Z',
endDate: '2021-01-01T00:00:00.000Z'
})
};
fetch('https://app.variable.global/api/v1/dataset', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.variable.global/api/v1/dataset",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Product Name',
'description' => 'A descriptive description',
'notes' => 'Internal notes about this product',
'sku' => 'SKU123',
'syncId' => 'sync123',
'cpcCode' => 'CPC123',
'supplierPartId' => 'PART-123',
'unit' => 'kg',
'weight' => [
'quantity' => 100,
'unit' => 'kg'
],
'packagingWeight' => [
'quantity' => 10,
'unit' => 'kg'
],
'recycledPercent' => 30,
'footprint' => [
'CO2e' => [
'A1' => '1200.0',
'A2' => '30.0',
'A3' => '4.0',
'A4' => '0.5',
'B1' => '0.06',
'B2' => '0.007',
'B3' => '0.0008',
'B4' => '',
'B5' => '',
'C1' => '',
'C2' => '',
'C3' => '',
'C4' => '',
'D' => ''
]
],
'dataQualityIndicators' => [
'description' => 'Primary data from the 2022 production year; background datasets from ecoinvent 3.9.',
'documentationYear' => 2019,
'coveragePercent' => 80,
'specificPercent' => 40,
'technologicalDQR' => 1,
'temporalDQR' => 1,
'geographicalDQR' => 1,
'completenessDQR' => 1,
'reliabilityDQR' => 1
],
'taxonomy' => [
'uuid' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => 'Material',
'path' => 'material'
],
'geoLocation' => [
'uuid' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => 'Pittsburgh, PA'
],
'location' => [
'uuid' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => 'Pittsburgh Office'
],
'startDate' => '2021-01-01T00:00:00.000Z',
'endDate' => '2021-01-01T00:00:00.000Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.variable.global/api/v1/dataset"
payload := strings.NewReader("{\n \"name\": \"Product Name\",\n \"description\": \"A descriptive description\",\n \"notes\": \"Internal notes about this product\",\n \"sku\": \"SKU123\",\n \"syncId\": \"sync123\",\n \"cpcCode\": \"CPC123\",\n \"supplierPartId\": \"PART-123\",\n \"unit\": \"kg\",\n \"weight\": {\n \"quantity\": 100,\n \"unit\": \"kg\"\n },\n \"packagingWeight\": {\n \"quantity\": 10,\n \"unit\": \"kg\"\n },\n \"recycledPercent\": 30,\n \"footprint\": {\n \"CO2e\": {\n \"A1\": \"1200.0\",\n \"A2\": \"30.0\",\n \"A3\": \"4.0\",\n \"A4\": \"0.5\",\n \"B1\": \"0.06\",\n \"B2\": \"0.007\",\n \"B3\": \"0.0008\",\n \"B4\": \"\",\n \"B5\": \"\",\n \"C1\": \"\",\n \"C2\": \"\",\n \"C3\": \"\",\n \"C4\": \"\",\n \"D\": \"\"\n }\n },\n \"dataQualityIndicators\": {\n \"description\": \"Primary data from the 2022 production year; background datasets from ecoinvent 3.9.\",\n \"documentationYear\": 2019,\n \"coveragePercent\": 80,\n \"specificPercent\": 40,\n \"technologicalDQR\": 1,\n \"temporalDQR\": 1,\n \"geographicalDQR\": 1,\n \"completenessDQR\": 1,\n \"reliabilityDQR\": 1\n },\n \"taxonomy\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Material\",\n \"path\": \"material\"\n },\n \"geoLocation\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Pittsburgh, PA\"\n },\n \"location\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Pittsburgh Office\"\n },\n \"startDate\": \"2021-01-01T00:00:00.000Z\",\n \"endDate\": \"2021-01-01T00:00:00.000Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.variable.global/api/v1/dataset")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Product Name\",\n \"description\": \"A descriptive description\",\n \"notes\": \"Internal notes about this product\",\n \"sku\": \"SKU123\",\n \"syncId\": \"sync123\",\n \"cpcCode\": \"CPC123\",\n \"supplierPartId\": \"PART-123\",\n \"unit\": \"kg\",\n \"weight\": {\n \"quantity\": 100,\n \"unit\": \"kg\"\n },\n \"packagingWeight\": {\n \"quantity\": 10,\n \"unit\": \"kg\"\n },\n \"recycledPercent\": 30,\n \"footprint\": {\n \"CO2e\": {\n \"A1\": \"1200.0\",\n \"A2\": \"30.0\",\n \"A3\": \"4.0\",\n \"A4\": \"0.5\",\n \"B1\": \"0.06\",\n \"B2\": \"0.007\",\n \"B3\": \"0.0008\",\n \"B4\": \"\",\n \"B5\": \"\",\n \"C1\": \"\",\n \"C2\": \"\",\n \"C3\": \"\",\n \"C4\": \"\",\n \"D\": \"\"\n }\n },\n \"dataQualityIndicators\": {\n \"description\": \"Primary data from the 2022 production year; background datasets from ecoinvent 3.9.\",\n \"documentationYear\": 2019,\n \"coveragePercent\": 80,\n \"specificPercent\": 40,\n \"technologicalDQR\": 1,\n \"temporalDQR\": 1,\n \"geographicalDQR\": 1,\n \"completenessDQR\": 1,\n \"reliabilityDQR\": 1\n },\n \"taxonomy\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Material\",\n \"path\": \"material\"\n },\n \"geoLocation\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Pittsburgh, PA\"\n },\n \"location\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Pittsburgh Office\"\n },\n \"startDate\": \"2021-01-01T00:00:00.000Z\",\n \"endDate\": \"2021-01-01T00:00:00.000Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.variable.global/api/v1/dataset")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Product Name\",\n \"description\": \"A descriptive description\",\n \"notes\": \"Internal notes about this product\",\n \"sku\": \"SKU123\",\n \"syncId\": \"sync123\",\n \"cpcCode\": \"CPC123\",\n \"supplierPartId\": \"PART-123\",\n \"unit\": \"kg\",\n \"weight\": {\n \"quantity\": 100,\n \"unit\": \"kg\"\n },\n \"packagingWeight\": {\n \"quantity\": 10,\n \"unit\": \"kg\"\n },\n \"recycledPercent\": 30,\n \"footprint\": {\n \"CO2e\": {\n \"A1\": \"1200.0\",\n \"A2\": \"30.0\",\n \"A3\": \"4.0\",\n \"A4\": \"0.5\",\n \"B1\": \"0.06\",\n \"B2\": \"0.007\",\n \"B3\": \"0.0008\",\n \"B4\": \"\",\n \"B5\": \"\",\n \"C1\": \"\",\n \"C2\": \"\",\n \"C3\": \"\",\n \"C4\": \"\",\n \"D\": \"\"\n }\n },\n \"dataQualityIndicators\": {\n \"description\": \"Primary data from the 2022 production year; background datasets from ecoinvent 3.9.\",\n \"documentationYear\": 2019,\n \"coveragePercent\": 80,\n \"specificPercent\": 40,\n \"technologicalDQR\": 1,\n \"temporalDQR\": 1,\n \"geographicalDQR\": 1,\n \"completenessDQR\": 1,\n \"reliabilityDQR\": 1\n },\n \"taxonomy\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Material\",\n \"path\": \"material\"\n },\n \"geoLocation\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Pittsburgh, PA\"\n },\n \"location\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Pittsburgh Office\"\n },\n \"startDate\": \"2021-01-01T00:00:00.000Z\",\n \"endDate\": \"2021-01-01T00:00:00.000Z\"\n}"
response = http.request(request)
puts response.read_body{
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Steel billet, hot rolled",
"description": "A descriptive description",
"notes": "Internal notes about this product",
"sku": "SKU123",
"syncId": "sync123",
"cpcCode": "CPC123",
"supplierPartId": "PART-123",
"unit": "kg",
"weight": {
"quantity": 100,
"unit": "kg"
},
"packagingWeight": {
"quantity": 10,
"unit": "kg"
},
"recycledPercent": 30,
"footprint": {
"CO2e": {
"A1": "1200.0",
"A2": "30.0",
"A3": "4.0",
"A4": "0.5",
"B1": "0.06",
"B2": "0.007",
"B3": "0.0008",
"B4": "",
"B5": "",
"C1": "",
"C2": "",
"C3": "",
"C4": "",
"D": "",
"totalCarbonFootprint": "1234.5678",
"productCarbonFootprint": "1234.0",
"upstream": "1230.0",
"direct": "4.0",
"downstream": "0.5678",
"A1_A3": "1234.0"
}
},
"dataQualityIndicators": {
"description": "Primary data from the 2022 production year; background datasets from ecoinvent 3.9.",
"documentationYear": 2019,
"coveragePercent": 80,
"specificPercent": 40,
"technologicalDQR": 1,
"temporalDQR": 1,
"geographicalDQR": 1,
"completenessDQR": 1,
"reliabilityDQR": 1,
"averagePercent": 60
},
"taxonomy": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Material",
"path": "material"
},
"geoLocation": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Pittsburgh, PA"
},
"location": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Pittsburgh Office"
},
"startDate": "2021-01-01T00:00:00.000Z",
"endDate": "2021-01-01T00:00:00.000Z",
"image": "https://app.variable.global/uploads/image.jpg",
"impacts": {
"GWP-fossil": {
"unit": "kgCO2e",
"method": "Mixed",
"totalCarbonFootprint": "10",
"A1_A3": "10"
},
"ODP": {
"unit": "kgCFC11e",
"method": "EN15804+A2 - Core impact categories and indicators",
"A1_A3": "0.0000012"
},
"AP": {
"unit": "molH+e",
"method": "EN15804+A2 - Core impact categories and indicators",
"A1_A3": "2"
}
},
"dataQualityRating": 1.4,
"created": "2021-01-01T00:00:00.000Z",
"updated": "2021-01-31T23:59:59.000Z",
"supplier": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"syncId": "sync123",
"name": "Company Name"
}
}{
"message": "token expired"
}Create Dataset
Create a new dataset
curl --request POST \
--url https://app.variable.global/api/v1/dataset \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Product Name",
"description": "A descriptive description",
"notes": "Internal notes about this product",
"sku": "SKU123",
"syncId": "sync123",
"cpcCode": "CPC123",
"supplierPartId": "PART-123",
"unit": "kg",
"weight": {
"quantity": 100,
"unit": "kg"
},
"packagingWeight": {
"quantity": 10,
"unit": "kg"
},
"recycledPercent": 30,
"footprint": {
"CO2e": {
"A1": "1200.0",
"A2": "30.0",
"A3": "4.0",
"A4": "0.5",
"B1": "0.06",
"B2": "0.007",
"B3": "0.0008",
"B4": "",
"B5": "",
"C1": "",
"C2": "",
"C3": "",
"C4": "",
"D": ""
}
},
"dataQualityIndicators": {
"description": "Primary data from the 2022 production year; background datasets from ecoinvent 3.9.",
"documentationYear": 2019,
"coveragePercent": 80,
"specificPercent": 40,
"technologicalDQR": 1,
"temporalDQR": 1,
"geographicalDQR": 1,
"completenessDQR": 1,
"reliabilityDQR": 1
},
"taxonomy": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Material",
"path": "material"
},
"geoLocation": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Pittsburgh, PA"
},
"location": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Pittsburgh Office"
},
"startDate": "2021-01-01T00:00:00.000Z",
"endDate": "2021-01-01T00:00:00.000Z"
}
'import requests
url = "https://app.variable.global/api/v1/dataset"
payload = {
"name": "Product Name",
"description": "A descriptive description",
"notes": "Internal notes about this product",
"sku": "SKU123",
"syncId": "sync123",
"cpcCode": "CPC123",
"supplierPartId": "PART-123",
"unit": "kg",
"weight": {
"quantity": 100,
"unit": "kg"
},
"packagingWeight": {
"quantity": 10,
"unit": "kg"
},
"recycledPercent": 30,
"footprint": { "CO2e": {
"A1": "1200.0",
"A2": "30.0",
"A3": "4.0",
"A4": "0.5",
"B1": "0.06",
"B2": "0.007",
"B3": "0.0008",
"B4": "",
"B5": "",
"C1": "",
"C2": "",
"C3": "",
"C4": "",
"D": ""
} },
"dataQualityIndicators": {
"description": "Primary data from the 2022 production year; background datasets from ecoinvent 3.9.",
"documentationYear": 2019,
"coveragePercent": 80,
"specificPercent": 40,
"technologicalDQR": 1,
"temporalDQR": 1,
"geographicalDQR": 1,
"completenessDQR": 1,
"reliabilityDQR": 1
},
"taxonomy": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Material",
"path": "material"
},
"geoLocation": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Pittsburgh, PA"
},
"location": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Pittsburgh Office"
},
"startDate": "2021-01-01T00:00:00.000Z",
"endDate": "2021-01-01T00:00:00.000Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Product Name',
description: 'A descriptive description',
notes: 'Internal notes about this product',
sku: 'SKU123',
syncId: 'sync123',
cpcCode: 'CPC123',
supplierPartId: 'PART-123',
unit: 'kg',
weight: {quantity: 100, unit: 'kg'},
packagingWeight: {quantity: 10, unit: 'kg'},
recycledPercent: 30,
footprint: {
CO2e: {
A1: '1200.0',
A2: '30.0',
A3: '4.0',
A4: '0.5',
B1: '0.06',
B2: '0.007',
B3: '0.0008',
B4: '',
B5: '',
C1: '',
C2: '',
C3: '',
C4: '',
D: ''
}
},
dataQualityIndicators: {
description: 'Primary data from the 2022 production year; background datasets from ecoinvent 3.9.',
documentationYear: 2019,
coveragePercent: 80,
specificPercent: 40,
technologicalDQR: 1,
temporalDQR: 1,
geographicalDQR: 1,
completenessDQR: 1,
reliabilityDQR: 1
},
taxonomy: {
uuid: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
name: 'Material',
path: 'material'
},
geoLocation: {uuid: '3c90c3cc-0d44-4b50-8888-8dd25736052a', name: 'Pittsburgh, PA'},
location: {uuid: '3c90c3cc-0d44-4b50-8888-8dd25736052a', name: 'Pittsburgh Office'},
startDate: '2021-01-01T00:00:00.000Z',
endDate: '2021-01-01T00:00:00.000Z'
})
};
fetch('https://app.variable.global/api/v1/dataset', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.variable.global/api/v1/dataset",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Product Name',
'description' => 'A descriptive description',
'notes' => 'Internal notes about this product',
'sku' => 'SKU123',
'syncId' => 'sync123',
'cpcCode' => 'CPC123',
'supplierPartId' => 'PART-123',
'unit' => 'kg',
'weight' => [
'quantity' => 100,
'unit' => 'kg'
],
'packagingWeight' => [
'quantity' => 10,
'unit' => 'kg'
],
'recycledPercent' => 30,
'footprint' => [
'CO2e' => [
'A1' => '1200.0',
'A2' => '30.0',
'A3' => '4.0',
'A4' => '0.5',
'B1' => '0.06',
'B2' => '0.007',
'B3' => '0.0008',
'B4' => '',
'B5' => '',
'C1' => '',
'C2' => '',
'C3' => '',
'C4' => '',
'D' => ''
]
],
'dataQualityIndicators' => [
'description' => 'Primary data from the 2022 production year; background datasets from ecoinvent 3.9.',
'documentationYear' => 2019,
'coveragePercent' => 80,
'specificPercent' => 40,
'technologicalDQR' => 1,
'temporalDQR' => 1,
'geographicalDQR' => 1,
'completenessDQR' => 1,
'reliabilityDQR' => 1
],
'taxonomy' => [
'uuid' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => 'Material',
'path' => 'material'
],
'geoLocation' => [
'uuid' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => 'Pittsburgh, PA'
],
'location' => [
'uuid' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => 'Pittsburgh Office'
],
'startDate' => '2021-01-01T00:00:00.000Z',
'endDate' => '2021-01-01T00:00:00.000Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.variable.global/api/v1/dataset"
payload := strings.NewReader("{\n \"name\": \"Product Name\",\n \"description\": \"A descriptive description\",\n \"notes\": \"Internal notes about this product\",\n \"sku\": \"SKU123\",\n \"syncId\": \"sync123\",\n \"cpcCode\": \"CPC123\",\n \"supplierPartId\": \"PART-123\",\n \"unit\": \"kg\",\n \"weight\": {\n \"quantity\": 100,\n \"unit\": \"kg\"\n },\n \"packagingWeight\": {\n \"quantity\": 10,\n \"unit\": \"kg\"\n },\n \"recycledPercent\": 30,\n \"footprint\": {\n \"CO2e\": {\n \"A1\": \"1200.0\",\n \"A2\": \"30.0\",\n \"A3\": \"4.0\",\n \"A4\": \"0.5\",\n \"B1\": \"0.06\",\n \"B2\": \"0.007\",\n \"B3\": \"0.0008\",\n \"B4\": \"\",\n \"B5\": \"\",\n \"C1\": \"\",\n \"C2\": \"\",\n \"C3\": \"\",\n \"C4\": \"\",\n \"D\": \"\"\n }\n },\n \"dataQualityIndicators\": {\n \"description\": \"Primary data from the 2022 production year; background datasets from ecoinvent 3.9.\",\n \"documentationYear\": 2019,\n \"coveragePercent\": 80,\n \"specificPercent\": 40,\n \"technologicalDQR\": 1,\n \"temporalDQR\": 1,\n \"geographicalDQR\": 1,\n \"completenessDQR\": 1,\n \"reliabilityDQR\": 1\n },\n \"taxonomy\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Material\",\n \"path\": \"material\"\n },\n \"geoLocation\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Pittsburgh, PA\"\n },\n \"location\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Pittsburgh Office\"\n },\n \"startDate\": \"2021-01-01T00:00:00.000Z\",\n \"endDate\": \"2021-01-01T00:00:00.000Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.variable.global/api/v1/dataset")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Product Name\",\n \"description\": \"A descriptive description\",\n \"notes\": \"Internal notes about this product\",\n \"sku\": \"SKU123\",\n \"syncId\": \"sync123\",\n \"cpcCode\": \"CPC123\",\n \"supplierPartId\": \"PART-123\",\n \"unit\": \"kg\",\n \"weight\": {\n \"quantity\": 100,\n \"unit\": \"kg\"\n },\n \"packagingWeight\": {\n \"quantity\": 10,\n \"unit\": \"kg\"\n },\n \"recycledPercent\": 30,\n \"footprint\": {\n \"CO2e\": {\n \"A1\": \"1200.0\",\n \"A2\": \"30.0\",\n \"A3\": \"4.0\",\n \"A4\": \"0.5\",\n \"B1\": \"0.06\",\n \"B2\": \"0.007\",\n \"B3\": \"0.0008\",\n \"B4\": \"\",\n \"B5\": \"\",\n \"C1\": \"\",\n \"C2\": \"\",\n \"C3\": \"\",\n \"C4\": \"\",\n \"D\": \"\"\n }\n },\n \"dataQualityIndicators\": {\n \"description\": \"Primary data from the 2022 production year; background datasets from ecoinvent 3.9.\",\n \"documentationYear\": 2019,\n \"coveragePercent\": 80,\n \"specificPercent\": 40,\n \"technologicalDQR\": 1,\n \"temporalDQR\": 1,\n \"geographicalDQR\": 1,\n \"completenessDQR\": 1,\n \"reliabilityDQR\": 1\n },\n \"taxonomy\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Material\",\n \"path\": \"material\"\n },\n \"geoLocation\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Pittsburgh, PA\"\n },\n \"location\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Pittsburgh Office\"\n },\n \"startDate\": \"2021-01-01T00:00:00.000Z\",\n \"endDate\": \"2021-01-01T00:00:00.000Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.variable.global/api/v1/dataset")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Product Name\",\n \"description\": \"A descriptive description\",\n \"notes\": \"Internal notes about this product\",\n \"sku\": \"SKU123\",\n \"syncId\": \"sync123\",\n \"cpcCode\": \"CPC123\",\n \"supplierPartId\": \"PART-123\",\n \"unit\": \"kg\",\n \"weight\": {\n \"quantity\": 100,\n \"unit\": \"kg\"\n },\n \"packagingWeight\": {\n \"quantity\": 10,\n \"unit\": \"kg\"\n },\n \"recycledPercent\": 30,\n \"footprint\": {\n \"CO2e\": {\n \"A1\": \"1200.0\",\n \"A2\": \"30.0\",\n \"A3\": \"4.0\",\n \"A4\": \"0.5\",\n \"B1\": \"0.06\",\n \"B2\": \"0.007\",\n \"B3\": \"0.0008\",\n \"B4\": \"\",\n \"B5\": \"\",\n \"C1\": \"\",\n \"C2\": \"\",\n \"C3\": \"\",\n \"C4\": \"\",\n \"D\": \"\"\n }\n },\n \"dataQualityIndicators\": {\n \"description\": \"Primary data from the 2022 production year; background datasets from ecoinvent 3.9.\",\n \"documentationYear\": 2019,\n \"coveragePercent\": 80,\n \"specificPercent\": 40,\n \"technologicalDQR\": 1,\n \"temporalDQR\": 1,\n \"geographicalDQR\": 1,\n \"completenessDQR\": 1,\n \"reliabilityDQR\": 1\n },\n \"taxonomy\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Material\",\n \"path\": \"material\"\n },\n \"geoLocation\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Pittsburgh, PA\"\n },\n \"location\": {\n \"uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"Pittsburgh Office\"\n },\n \"startDate\": \"2021-01-01T00:00:00.000Z\",\n \"endDate\": \"2021-01-01T00:00:00.000Z\"\n}"
response = http.request(request)
puts response.read_body{
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Steel billet, hot rolled",
"description": "A descriptive description",
"notes": "Internal notes about this product",
"sku": "SKU123",
"syncId": "sync123",
"cpcCode": "CPC123",
"supplierPartId": "PART-123",
"unit": "kg",
"weight": {
"quantity": 100,
"unit": "kg"
},
"packagingWeight": {
"quantity": 10,
"unit": "kg"
},
"recycledPercent": 30,
"footprint": {
"CO2e": {
"A1": "1200.0",
"A2": "30.0",
"A3": "4.0",
"A4": "0.5",
"B1": "0.06",
"B2": "0.007",
"B3": "0.0008",
"B4": "",
"B5": "",
"C1": "",
"C2": "",
"C3": "",
"C4": "",
"D": "",
"totalCarbonFootprint": "1234.5678",
"productCarbonFootprint": "1234.0",
"upstream": "1230.0",
"direct": "4.0",
"downstream": "0.5678",
"A1_A3": "1234.0"
}
},
"dataQualityIndicators": {
"description": "Primary data from the 2022 production year; background datasets from ecoinvent 3.9.",
"documentationYear": 2019,
"coveragePercent": 80,
"specificPercent": 40,
"technologicalDQR": 1,
"temporalDQR": 1,
"geographicalDQR": 1,
"completenessDQR": 1,
"reliabilityDQR": 1,
"averagePercent": 60
},
"taxonomy": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Material",
"path": "material"
},
"geoLocation": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Pittsburgh, PA"
},
"location": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Pittsburgh Office"
},
"startDate": "2021-01-01T00:00:00.000Z",
"endDate": "2021-01-01T00:00:00.000Z",
"image": "https://app.variable.global/uploads/image.jpg",
"impacts": {
"GWP-fossil": {
"unit": "kgCO2e",
"method": "Mixed",
"totalCarbonFootprint": "10",
"A1_A3": "10"
},
"ODP": {
"unit": "kgCFC11e",
"method": "EN15804+A2 - Core impact categories and indicators",
"A1_A3": "0.0000012"
},
"AP": {
"unit": "molH+e",
"method": "EN15804+A2 - Core impact categories and indicators",
"A1_A3": "2"
}
},
"dataQualityRating": 1.4,
"created": "2021-01-01T00:00:00.000Z",
"updated": "2021-01-31T23:59:59.000Z",
"supplier": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"syncId": "sync123",
"name": "Company Name"
}
}{
"message": "token expired"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
"Product Name"
"A descriptive description"
"Internal notes about this product"
"SKU123"
"CPC123"
The supplier's part identifier for this product.
"PART-123"
The unit code (e.g. kg, lbs, etc.). All unit codes can be found in the List Units endpoint.
"kg"
The user-declared weight of the product. On read responses, compare with the server-computed modeledWeight to mass-balance the product against its bill of materials.
Show child attributes
Show child attributes
The user-declared weight of the product's packaging. On read responses, compare with the server-computed modeledPackagingWeight to mass-balance packaging against its bill of materials.
Show child attributes
Show child attributes
The user-declared recycled content of the product as a percentage (0–100). A 0 is a declared zero; omit the field when undeclared. On read responses, compare with the server-computed modeledRecycledPercent.
30
Using dataSource: external allows setting certain footprint.CO2e values. The values are computed all other dataSources.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
A reference to a taxonomy category, including its machine-readable path.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
ISO 8601 date
"2021-01-01T00:00:00.000Z"
ISO 8601 date
"2021-01-01T00:00:00.000Z"
Response
A dataset
"Steel billet, hot rolled"
"A descriptive description"
"Internal notes about this product"
"SKU123"
"CPC123"
The supplier's part identifier for this product.
"PART-123"
The unit code (e.g. kg, lbs, etc.). All unit codes can be found in the List Units endpoint.
"kg"
The user-declared weight of the product. On read responses, compare with the server-computed modeledWeight to mass-balance the product against its bill of materials.
Show child attributes
Show child attributes
The user-declared weight of the product's packaging. On read responses, compare with the server-computed modeledPackagingWeight to mass-balance packaging against its bill of materials.
Show child attributes
Show child attributes
The user-declared recycled content of the product as a percentage (0–100). A 0 is a declared zero; omit the field when undeclared. On read responses, compare with the server-computed modeledRecycledPercent.
30
Deprecated — use impacts["GWP-fossil"]. Kept for backwards compatibility.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
A reference to a taxonomy category, including its machine-readable path.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
ISO 8601 date
"2021-01-01T00:00:00.000Z"
ISO 8601 date
"2021-01-01T00:00:00.000Z"
"https://app.variable.global/uploads/image.jpg"
Environmental impact indicators keyed by canonical code (e.g. GWP-fossil, ODP, AP). Which indicators appear is controlled by the impacts query parameter — by default only GWP-fossil is returned.
Show child attributes
Show child attributes
{
"GWP-fossil": {
"unit": "kgCO2e",
"method": "Mixed",
"totalCarbonFootprint": "10",
"A1_A3": "10"
},
"ODP": {
"unit": "kgCFC11e",
"method": "EN15804+A2 - Core impact categories and indicators",
"A1_A3": "0.0000012"
},
"AP": {
"unit": "molH+e",
"method": "EN15804+A2 - Core impact categories and indicators",
"A1_A3": "2"
}
}
1.4
ISO 8601 date
"2021-01-01T00:00:00.000Z"
ISO 8601 date
"2021-01-31T23:59:59.000Z"
Show child attributes
Show child attributes