Events
Update an event
Updates a specific event by ID.
PATCH
/
projects
/
{project_id}
/
events
/
{event_id}
Update an event
curl --request PATCH \
--url https://app.gomangrove.com/api/v1/projects/{project_id}/events/{event_id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"event": {
"start_time": "2024-06-05T00:00:00.000Z",
"end_time": "2024-06-05T23:59:59.000Z",
"locations": [
{
"id": "loc_8XF1QtGs79oX9A6k"
},
{
"id": "loc_8XF1QtGs79oX9A6k"
}
],
"data_points": [
{
"slug": "total-ash-delivered-wet-us-ton",
"value": 290.7
}
]
}
}
'import requests
url = "https://app.gomangrove.com/api/v1/projects/{project_id}/events/{event_id}"
payload = { "event": {
"start_time": "2024-06-05T00:00:00.000Z",
"end_time": "2024-06-05T23:59:59.000Z",
"locations": [{ "id": "loc_8XF1QtGs79oX9A6k" }, { "id": "loc_8XF1QtGs79oX9A6k" }],
"data_points": [
{
"slug": "total-ash-delivered-wet-us-ton",
"value": 290.7
}
]
} }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
event: {
start_time: '2024-06-05T00:00:00.000Z',
end_time: '2024-06-05T23:59:59.000Z',
locations: [{id: 'loc_8XF1QtGs79oX9A6k'}, {id: 'loc_8XF1QtGs79oX9A6k'}],
data_points: [{slug: 'total-ash-delivered-wet-us-ton', value: 290.7}]
}
})
};
fetch('https://app.gomangrove.com/api/v1/projects/{project_id}/events/{event_id}', 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/{event_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'event' => [
'start_time' => '2024-06-05T00:00:00.000Z',
'end_time' => '2024-06-05T23:59:59.000Z',
'locations' => [
[
'id' => 'loc_8XF1QtGs79oX9A6k'
],
[
'id' => 'loc_8XF1QtGs79oX9A6k'
]
],
'data_points' => [
[
'slug' => 'total-ash-delivered-wet-us-ton',
'value' => 290.7
]
]
]
]),
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/{event_id}"
payload := strings.NewReader("{\n \"event\": {\n \"start_time\": \"2024-06-05T00:00:00.000Z\",\n \"end_time\": \"2024-06-05T23:59:59.000Z\",\n \"locations\": [\n {\n \"id\": \"loc_8XF1QtGs79oX9A6k\"\n },\n {\n \"id\": \"loc_8XF1QtGs79oX9A6k\"\n }\n ],\n \"data_points\": [\n {\n \"slug\": \"total-ash-delivered-wet-us-ton\",\n \"value\": 290.7\n }\n ]\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://app.gomangrove.com/api/v1/projects/{project_id}/events/{event_id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"event\": {\n \"start_time\": \"2024-06-05T00:00:00.000Z\",\n \"end_time\": \"2024-06-05T23:59:59.000Z\",\n \"locations\": [\n {\n \"id\": \"loc_8XF1QtGs79oX9A6k\"\n },\n {\n \"id\": \"loc_8XF1QtGs79oX9A6k\"\n }\n ],\n \"data_points\": [\n {\n \"slug\": \"total-ash-delivered-wet-us-ton\",\n \"value\": 290.7\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.gomangrove.com/api/v1/projects/{project_id}/events/{event_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"event\": {\n \"start_time\": \"2024-06-05T00:00:00.000Z\",\n \"end_time\": \"2024-06-05T23:59:59.000Z\",\n \"locations\": [\n {\n \"id\": \"loc_8XF1QtGs79oX9A6k\"\n },\n {\n \"id\": \"loc_8XF1QtGs79oX9A6k\"\n }\n ],\n \"data_points\": [\n {\n \"slug\": \"total-ash-delivered-wet-us-ton\",\n \"value\": 290.7\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "evt_DLnYvzbjSujNAvXE",
"slug": "biochar-delivery",
"event_type": "Biochar Delivery",
"tracking_id": "MG1003",
"start_time": "2024-06-05T00:00:00.000Z",
"end_time": "2024-06-05T23:59:59.000Z",
"has_rule_alerts": false,
"data_points": [
{
"id": "in_JuGzRS08MbVSEkCj",
"slug": "total-ash-delivered-wet-us-ton",
"data_point_type": "Total Ash Delivered (wet mass) U.S. ton",
"value": 290.7,
"unit": "U.S. ton",
"status": "complete",
"rule_results": []
},
{
"id": "in_c3krFTxCxJSQR5Rc",
"slug": "distance-biochar-transported",
"data_point_type": "Biochar distance transported",
"value": 15.3,
"unit": "mile",
"status": "complete",
"rule_results": []
},
{
"id": "in_AIKqFEtr5OpAqram",
"slug": "biochar-end-use",
"data_point_type": "Biochar end use",
"value": "soil amendment",
"unit": null,
"status": "complete",
"rule_results": []
}
],
"locations": [
{
"id": "loc_8XF1QtGs79oX9A6k",
"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_8XF1QtGs79oX9A6k",
"lat": "41.2733453",
"long": "-122.2246676",
"name": "Customer Location 2",
"address": {
"name": "Customer Location 2",
"street_address_1": null,
"street_address_2": null,
"city": null,
"state": null,
"postal_code": null,
"country": "CA"
}
}
],
"evidences": []
}{
"status": "error",
"statusCode": 404,
"errors": [
{
"message": "record not found"
}
]
}⌘I
Update an event
curl --request PATCH \
--url https://app.gomangrove.com/api/v1/projects/{project_id}/events/{event_id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"event": {
"start_time": "2024-06-05T00:00:00.000Z",
"end_time": "2024-06-05T23:59:59.000Z",
"locations": [
{
"id": "loc_8XF1QtGs79oX9A6k"
},
{
"id": "loc_8XF1QtGs79oX9A6k"
}
],
"data_points": [
{
"slug": "total-ash-delivered-wet-us-ton",
"value": 290.7
}
]
}
}
'import requests
url = "https://app.gomangrove.com/api/v1/projects/{project_id}/events/{event_id}"
payload = { "event": {
"start_time": "2024-06-05T00:00:00.000Z",
"end_time": "2024-06-05T23:59:59.000Z",
"locations": [{ "id": "loc_8XF1QtGs79oX9A6k" }, { "id": "loc_8XF1QtGs79oX9A6k" }],
"data_points": [
{
"slug": "total-ash-delivered-wet-us-ton",
"value": 290.7
}
]
} }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
event: {
start_time: '2024-06-05T00:00:00.000Z',
end_time: '2024-06-05T23:59:59.000Z',
locations: [{id: 'loc_8XF1QtGs79oX9A6k'}, {id: 'loc_8XF1QtGs79oX9A6k'}],
data_points: [{slug: 'total-ash-delivered-wet-us-ton', value: 290.7}]
}
})
};
fetch('https://app.gomangrove.com/api/v1/projects/{project_id}/events/{event_id}', 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/{event_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'event' => [
'start_time' => '2024-06-05T00:00:00.000Z',
'end_time' => '2024-06-05T23:59:59.000Z',
'locations' => [
[
'id' => 'loc_8XF1QtGs79oX9A6k'
],
[
'id' => 'loc_8XF1QtGs79oX9A6k'
]
],
'data_points' => [
[
'slug' => 'total-ash-delivered-wet-us-ton',
'value' => 290.7
]
]
]
]),
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/{event_id}"
payload := strings.NewReader("{\n \"event\": {\n \"start_time\": \"2024-06-05T00:00:00.000Z\",\n \"end_time\": \"2024-06-05T23:59:59.000Z\",\n \"locations\": [\n {\n \"id\": \"loc_8XF1QtGs79oX9A6k\"\n },\n {\n \"id\": \"loc_8XF1QtGs79oX9A6k\"\n }\n ],\n \"data_points\": [\n {\n \"slug\": \"total-ash-delivered-wet-us-ton\",\n \"value\": 290.7\n }\n ]\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://app.gomangrove.com/api/v1/projects/{project_id}/events/{event_id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"event\": {\n \"start_time\": \"2024-06-05T00:00:00.000Z\",\n \"end_time\": \"2024-06-05T23:59:59.000Z\",\n \"locations\": [\n {\n \"id\": \"loc_8XF1QtGs79oX9A6k\"\n },\n {\n \"id\": \"loc_8XF1QtGs79oX9A6k\"\n }\n ],\n \"data_points\": [\n {\n \"slug\": \"total-ash-delivered-wet-us-ton\",\n \"value\": 290.7\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.gomangrove.com/api/v1/projects/{project_id}/events/{event_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"event\": {\n \"start_time\": \"2024-06-05T00:00:00.000Z\",\n \"end_time\": \"2024-06-05T23:59:59.000Z\",\n \"locations\": [\n {\n \"id\": \"loc_8XF1QtGs79oX9A6k\"\n },\n {\n \"id\": \"loc_8XF1QtGs79oX9A6k\"\n }\n ],\n \"data_points\": [\n {\n \"slug\": \"total-ash-delivered-wet-us-ton\",\n \"value\": 290.7\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "evt_DLnYvzbjSujNAvXE",
"slug": "biochar-delivery",
"event_type": "Biochar Delivery",
"tracking_id": "MG1003",
"start_time": "2024-06-05T00:00:00.000Z",
"end_time": "2024-06-05T23:59:59.000Z",
"has_rule_alerts": false,
"data_points": [
{
"id": "in_JuGzRS08MbVSEkCj",
"slug": "total-ash-delivered-wet-us-ton",
"data_point_type": "Total Ash Delivered (wet mass) U.S. ton",
"value": 290.7,
"unit": "U.S. ton",
"status": "complete",
"rule_results": []
},
{
"id": "in_c3krFTxCxJSQR5Rc",
"slug": "distance-biochar-transported",
"data_point_type": "Biochar distance transported",
"value": 15.3,
"unit": "mile",
"status": "complete",
"rule_results": []
},
{
"id": "in_AIKqFEtr5OpAqram",
"slug": "biochar-end-use",
"data_point_type": "Biochar end use",
"value": "soil amendment",
"unit": null,
"status": "complete",
"rule_results": []
}
],
"locations": [
{
"id": "loc_8XF1QtGs79oX9A6k",
"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_8XF1QtGs79oX9A6k",
"lat": "41.2733453",
"long": "-122.2246676",
"name": "Customer Location 2",
"address": {
"name": "Customer Location 2",
"street_address_1": null,
"street_address_2": null,
"city": null,
"state": null,
"postal_code": null,
"country": "CA"
}
}
],
"evidences": []
}{
"status": "error",
"statusCode": 404,
"errors": [
{
"message": "record not found"
}
]
}