Events
Create an event
Creates events to capture ongoing operational data within a specific project boundary.
POST
/
projects
/
{project_id}
/
events
Create an event on a project
curl --request POST \
--url https://app.gomangrove.com/api/v1/projects/{project_id}/events \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"event": {
"event_type": "biochar-delivery",
"start_time": "2024-06-04T00:00:00.000Z",
"end_time": "2024-06-04T23:59:59.000Z",
"tracking_id": "MG1003",
"notes": "A note about this event",
"locations": [
{
"id": "loc_mNoP3456qRsT7890"
},
{
"id": "loc_uVwX1234yZaB5678"
}
],
"asset_id": "asset_AAAAAAAAAAAAAAAA",
"data_points": [
{
"slug": "total-ash-delivered-wet-us-ton",
"value": 290.6
},
{
"slug": "distance-biochar-transported",
"value": 15.3
},
{
"slug": "biochar-end-use",
"value": "soil amendment"
}
]
}
}
'import requests
url = "https://app.gomangrove.com/api/v1/projects/{project_id}/events"
payload = { "event": {
"event_type": "biochar-delivery",
"start_time": "2024-06-04T00:00:00.000Z",
"end_time": "2024-06-04T23:59:59.000Z",
"tracking_id": "MG1003",
"notes": "A note about this event",
"locations": [{ "id": "loc_mNoP3456qRsT7890" }, { "id": "loc_uVwX1234yZaB5678" }],
"asset_id": "asset_AAAAAAAAAAAAAAAA",
"data_points": [
{
"slug": "total-ash-delivered-wet-us-ton",
"value": 290.6
},
{
"slug": "distance-biochar-transported",
"value": 15.3
},
{
"slug": "biochar-end-use",
"value": "soil amendment"
}
]
} }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
event: {
event_type: 'biochar-delivery',
start_time: '2024-06-04T00:00:00.000Z',
end_time: '2024-06-04T23:59:59.000Z',
tracking_id: 'MG1003',
notes: 'A note about this event',
locations: [{id: 'loc_mNoP3456qRsT7890'}, {id: 'loc_uVwX1234yZaB5678'}],
asset_id: 'asset_AAAAAAAAAAAAAAAA',
data_points: [
{slug: 'total-ash-delivered-wet-us-ton', value: 290.6},
{slug: 'distance-biochar-transported', value: 15.3},
{slug: 'biochar-end-use', value: 'soil amendment'}
]
}
})
};
fetch('https://app.gomangrove.com/api/v1/projects/{project_id}/events', 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.gomangrove.com/api/v1/projects/{project_id}/events",
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([
'event' => [
'event_type' => 'biochar-delivery',
'start_time' => '2024-06-04T00:00:00.000Z',
'end_time' => '2024-06-04T23:59:59.000Z',
'tracking_id' => 'MG1003',
'notes' => 'A note about this event',
'locations' => [
[
'id' => 'loc_mNoP3456qRsT7890'
],
[
'id' => 'loc_uVwX1234yZaB5678'
]
],
'asset_id' => 'asset_AAAAAAAAAAAAAAAA',
'data_points' => [
[
'slug' => 'total-ash-delivered-wet-us-ton',
'value' => 290.6
],
[
'slug' => 'distance-biochar-transported',
'value' => 15.3
],
[
'slug' => 'biochar-end-use',
'value' => 'soil amendment'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.gomangrove.com/api/v1/projects/{project_id}/events"
payload := strings.NewReader("{\n \"event\": {\n \"event_type\": \"biochar-delivery\",\n \"start_time\": \"2024-06-04T00:00:00.000Z\",\n \"end_time\": \"2024-06-04T23:59:59.000Z\",\n \"tracking_id\": \"MG1003\",\n \"notes\": \"A note about this event\",\n \"locations\": [\n {\n \"id\": \"loc_mNoP3456qRsT7890\"\n },\n {\n \"id\": \"loc_uVwX1234yZaB5678\"\n }\n ],\n \"asset_id\": \"asset_AAAAAAAAAAAAAAAA\",\n \"data_points\": [\n {\n \"slug\": \"total-ash-delivered-wet-us-ton\",\n \"value\": 290.6\n },\n {\n \"slug\": \"distance-biochar-transported\",\n \"value\": 15.3\n },\n {\n \"slug\": \"biochar-end-use\",\n \"value\": \"soil amendment\"\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.gomangrove.com/api/v1/projects/{project_id}/events")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"event\": {\n \"event_type\": \"biochar-delivery\",\n \"start_time\": \"2024-06-04T00:00:00.000Z\",\n \"end_time\": \"2024-06-04T23:59:59.000Z\",\n \"tracking_id\": \"MG1003\",\n \"notes\": \"A note about this event\",\n \"locations\": [\n {\n \"id\": \"loc_mNoP3456qRsT7890\"\n },\n {\n \"id\": \"loc_uVwX1234yZaB5678\"\n }\n ],\n \"asset_id\": \"asset_AAAAAAAAAAAAAAAA\",\n \"data_points\": [\n {\n \"slug\": \"total-ash-delivered-wet-us-ton\",\n \"value\": 290.6\n },\n {\n \"slug\": \"distance-biochar-transported\",\n \"value\": 15.3\n },\n {\n \"slug\": \"biochar-end-use\",\n \"value\": \"soil amendment\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.gomangrove.com/api/v1/projects/{project_id}/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"event\": {\n \"event_type\": \"biochar-delivery\",\n \"start_time\": \"2024-06-04T00:00:00.000Z\",\n \"end_time\": \"2024-06-04T23:59:59.000Z\",\n \"tracking_id\": \"MG1003\",\n \"notes\": \"A note about this event\",\n \"locations\": [\n {\n \"id\": \"loc_mNoP3456qRsT7890\"\n },\n {\n \"id\": \"loc_uVwX1234yZaB5678\"\n }\n ],\n \"asset_id\": \"asset_AAAAAAAAAAAAAAAA\",\n \"data_points\": [\n {\n \"slug\": \"total-ash-delivered-wet-us-ton\",\n \"value\": 290.6\n },\n {\n \"slug\": \"distance-biochar-transported\",\n \"value\": 15.3\n },\n {\n \"slug\": \"biochar-end-use\",\n \"value\": \"soil amendment\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "evt_mNoP3456qRsT7890",
"slug": "biochar-delivery",
"event_type": "Biochar Delivery",
"tracking_id": "MG1003",
"start_time": "2024-06-04T00:00:00.000Z",
"end_time": "2024-06-04T23:59:59.000Z",
"has_rule_alerts": true,
"data_points": [
{
"id": "in_mNoP3456qRsT7890",
"slug": "total-ash-delivered-wet-us-ton",
"data_point_type": "Total Ash Delivered (wet mass) U.S. ton",
"value": 290.6,
"unit": "U.S. ton",
"status": "complete",
"substituted": false,
"raw_value": null,
"substitution": null,
"rule_results": [
{
"id": "dpres_8kQ2mNvX1aBcDeFg",
"status": "fail",
"entered_value": "290.6",
"rule_id": "rule_4cd9b2f6e1a08",
"rule_version": 2,
"rule_name": "Ash delivered within expected range",
"data_point_id": "in_mNoP3456qRsT7890",
"data_point_slug": "total-ash-delivered-wet-us-ton",
"dismissed_at": null,
"dismissed_by": null,
"dismissal_reason": null,
"evaluated_at": "2024-06-04T12:00:00.000Z"
}
]
},
{
"id": "in_uVwX1234yZaB5678",
"slug": "distance-biochar-transported",
"data_point_type": "Biochar distance transported",
"value": 15.3,
"unit": "mile",
"status": "complete",
"substituted": true,
"raw_value": 12,
"substitution": {
"source": "rule",
"method": "fallback_to_dpt",
"from_value": 12,
"to_value": 15.3,
"created_at": "2024-06-04T12:00:00.000Z",
"created_by": null,
"rule": {
"name": "Distance within expected range",
"friendly_id": "rule_9ab1c2d3e4f56"
}
}
},
{
"id": "in_cDeF9012gHiJ3456",
"slug": "biochar-end-use",
"data_point_type": "Biochar end use",
"value": "soil amendment",
"unit": null,
"status": "complete",
"substituted": false,
"raw_value": null,
"substitution": null
}
],
"locations": [
{
"id": "loc_mNoP3456qRsT7890",
"lat": "40.4773493",
"long": "-124.1226179",
"name": "Production Facility",
"address": {
"name": "Production Facility",
"street_address_1": null,
"street_address_2": null,
"city": null,
"state": null,
"postal_code": null,
"country": "CA"
}
},
{
"id": "loc_uVwX1234yZaB5678",
"lat": "41.2733453",
"long": "-122.2246676",
"name": "Customer Location",
"address": {
"name": "Customer Location",
"street_address_1": null,
"street_address_2": null,
"city": null,
"state": null,
"postal_code": null,
"country": "CA"
}
}
],
"evidences": [],
"feedstock_id": null,
"asset_id": "asset_AAAAAAAAAAAAAAAA",
"asset": {
"id": "asset_AAAAAAAAAAAAAAAA",
"name": "Reactor A1"
}
}{
"errors": [
{
"message": "Data point 'distance-biochar-transported': value must be a single number value, not a list"
}
]
}{
"status": "error",
"statusCode": 404,
"errors": [
{
"message": "record not found"
}
]
}⌘I
Create an event on a project
curl --request POST \
--url https://app.gomangrove.com/api/v1/projects/{project_id}/events \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"event": {
"event_type": "biochar-delivery",
"start_time": "2024-06-04T00:00:00.000Z",
"end_time": "2024-06-04T23:59:59.000Z",
"tracking_id": "MG1003",
"notes": "A note about this event",
"locations": [
{
"id": "loc_mNoP3456qRsT7890"
},
{
"id": "loc_uVwX1234yZaB5678"
}
],
"asset_id": "asset_AAAAAAAAAAAAAAAA",
"data_points": [
{
"slug": "total-ash-delivered-wet-us-ton",
"value": 290.6
},
{
"slug": "distance-biochar-transported",
"value": 15.3
},
{
"slug": "biochar-end-use",
"value": "soil amendment"
}
]
}
}
'import requests
url = "https://app.gomangrove.com/api/v1/projects/{project_id}/events"
payload = { "event": {
"event_type": "biochar-delivery",
"start_time": "2024-06-04T00:00:00.000Z",
"end_time": "2024-06-04T23:59:59.000Z",
"tracking_id": "MG1003",
"notes": "A note about this event",
"locations": [{ "id": "loc_mNoP3456qRsT7890" }, { "id": "loc_uVwX1234yZaB5678" }],
"asset_id": "asset_AAAAAAAAAAAAAAAA",
"data_points": [
{
"slug": "total-ash-delivered-wet-us-ton",
"value": 290.6
},
{
"slug": "distance-biochar-transported",
"value": 15.3
},
{
"slug": "biochar-end-use",
"value": "soil amendment"
}
]
} }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
event: {
event_type: 'biochar-delivery',
start_time: '2024-06-04T00:00:00.000Z',
end_time: '2024-06-04T23:59:59.000Z',
tracking_id: 'MG1003',
notes: 'A note about this event',
locations: [{id: 'loc_mNoP3456qRsT7890'}, {id: 'loc_uVwX1234yZaB5678'}],
asset_id: 'asset_AAAAAAAAAAAAAAAA',
data_points: [
{slug: 'total-ash-delivered-wet-us-ton', value: 290.6},
{slug: 'distance-biochar-transported', value: 15.3},
{slug: 'biochar-end-use', value: 'soil amendment'}
]
}
})
};
fetch('https://app.gomangrove.com/api/v1/projects/{project_id}/events', 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.gomangrove.com/api/v1/projects/{project_id}/events",
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([
'event' => [
'event_type' => 'biochar-delivery',
'start_time' => '2024-06-04T00:00:00.000Z',
'end_time' => '2024-06-04T23:59:59.000Z',
'tracking_id' => 'MG1003',
'notes' => 'A note about this event',
'locations' => [
[
'id' => 'loc_mNoP3456qRsT7890'
],
[
'id' => 'loc_uVwX1234yZaB5678'
]
],
'asset_id' => 'asset_AAAAAAAAAAAAAAAA',
'data_points' => [
[
'slug' => 'total-ash-delivered-wet-us-ton',
'value' => 290.6
],
[
'slug' => 'distance-biochar-transported',
'value' => 15.3
],
[
'slug' => 'biochar-end-use',
'value' => 'soil amendment'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.gomangrove.com/api/v1/projects/{project_id}/events"
payload := strings.NewReader("{\n \"event\": {\n \"event_type\": \"biochar-delivery\",\n \"start_time\": \"2024-06-04T00:00:00.000Z\",\n \"end_time\": \"2024-06-04T23:59:59.000Z\",\n \"tracking_id\": \"MG1003\",\n \"notes\": \"A note about this event\",\n \"locations\": [\n {\n \"id\": \"loc_mNoP3456qRsT7890\"\n },\n {\n \"id\": \"loc_uVwX1234yZaB5678\"\n }\n ],\n \"asset_id\": \"asset_AAAAAAAAAAAAAAAA\",\n \"data_points\": [\n {\n \"slug\": \"total-ash-delivered-wet-us-ton\",\n \"value\": 290.6\n },\n {\n \"slug\": \"distance-biochar-transported\",\n \"value\": 15.3\n },\n {\n \"slug\": \"biochar-end-use\",\n \"value\": \"soil amendment\"\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.gomangrove.com/api/v1/projects/{project_id}/events")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"event\": {\n \"event_type\": \"biochar-delivery\",\n \"start_time\": \"2024-06-04T00:00:00.000Z\",\n \"end_time\": \"2024-06-04T23:59:59.000Z\",\n \"tracking_id\": \"MG1003\",\n \"notes\": \"A note about this event\",\n \"locations\": [\n {\n \"id\": \"loc_mNoP3456qRsT7890\"\n },\n {\n \"id\": \"loc_uVwX1234yZaB5678\"\n }\n ],\n \"asset_id\": \"asset_AAAAAAAAAAAAAAAA\",\n \"data_points\": [\n {\n \"slug\": \"total-ash-delivered-wet-us-ton\",\n \"value\": 290.6\n },\n {\n \"slug\": \"distance-biochar-transported\",\n \"value\": 15.3\n },\n {\n \"slug\": \"biochar-end-use\",\n \"value\": \"soil amendment\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.gomangrove.com/api/v1/projects/{project_id}/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"event\": {\n \"event_type\": \"biochar-delivery\",\n \"start_time\": \"2024-06-04T00:00:00.000Z\",\n \"end_time\": \"2024-06-04T23:59:59.000Z\",\n \"tracking_id\": \"MG1003\",\n \"notes\": \"A note about this event\",\n \"locations\": [\n {\n \"id\": \"loc_mNoP3456qRsT7890\"\n },\n {\n \"id\": \"loc_uVwX1234yZaB5678\"\n }\n ],\n \"asset_id\": \"asset_AAAAAAAAAAAAAAAA\",\n \"data_points\": [\n {\n \"slug\": \"total-ash-delivered-wet-us-ton\",\n \"value\": 290.6\n },\n {\n \"slug\": \"distance-biochar-transported\",\n \"value\": 15.3\n },\n {\n \"slug\": \"biochar-end-use\",\n \"value\": \"soil amendment\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "evt_mNoP3456qRsT7890",
"slug": "biochar-delivery",
"event_type": "Biochar Delivery",
"tracking_id": "MG1003",
"start_time": "2024-06-04T00:00:00.000Z",
"end_time": "2024-06-04T23:59:59.000Z",
"has_rule_alerts": true,
"data_points": [
{
"id": "in_mNoP3456qRsT7890",
"slug": "total-ash-delivered-wet-us-ton",
"data_point_type": "Total Ash Delivered (wet mass) U.S. ton",
"value": 290.6,
"unit": "U.S. ton",
"status": "complete",
"substituted": false,
"raw_value": null,
"substitution": null,
"rule_results": [
{
"id": "dpres_8kQ2mNvX1aBcDeFg",
"status": "fail",
"entered_value": "290.6",
"rule_id": "rule_4cd9b2f6e1a08",
"rule_version": 2,
"rule_name": "Ash delivered within expected range",
"data_point_id": "in_mNoP3456qRsT7890",
"data_point_slug": "total-ash-delivered-wet-us-ton",
"dismissed_at": null,
"dismissed_by": null,
"dismissal_reason": null,
"evaluated_at": "2024-06-04T12:00:00.000Z"
}
]
},
{
"id": "in_uVwX1234yZaB5678",
"slug": "distance-biochar-transported",
"data_point_type": "Biochar distance transported",
"value": 15.3,
"unit": "mile",
"status": "complete",
"substituted": true,
"raw_value": 12,
"substitution": {
"source": "rule",
"method": "fallback_to_dpt",
"from_value": 12,
"to_value": 15.3,
"created_at": "2024-06-04T12:00:00.000Z",
"created_by": null,
"rule": {
"name": "Distance within expected range",
"friendly_id": "rule_9ab1c2d3e4f56"
}
}
},
{
"id": "in_cDeF9012gHiJ3456",
"slug": "biochar-end-use",
"data_point_type": "Biochar end use",
"value": "soil amendment",
"unit": null,
"status": "complete",
"substituted": false,
"raw_value": null,
"substitution": null
}
],
"locations": [
{
"id": "loc_mNoP3456qRsT7890",
"lat": "40.4773493",
"long": "-124.1226179",
"name": "Production Facility",
"address": {
"name": "Production Facility",
"street_address_1": null,
"street_address_2": null,
"city": null,
"state": null,
"postal_code": null,
"country": "CA"
}
},
{
"id": "loc_uVwX1234yZaB5678",
"lat": "41.2733453",
"long": "-122.2246676",
"name": "Customer Location",
"address": {
"name": "Customer Location",
"street_address_1": null,
"street_address_2": null,
"city": null,
"state": null,
"postal_code": null,
"country": "CA"
}
}
],
"evidences": [],
"feedstock_id": null,
"asset_id": "asset_AAAAAAAAAAAAAAAA",
"asset": {
"id": "asset_AAAAAAAAAAAAAAAA",
"name": "Reactor A1"
}
}{
"errors": [
{
"message": "Data point 'distance-biochar-transported': value must be a single number value, not a list"
}
]
}{
"status": "error",
"statusCode": 404,
"errors": [
{
"message": "record not found"
}
]
}