Update Goal
curl --request PATCH \
--url https://api.omi.me/v1/dev/user/goals/{goal_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"current_value": 123,
"desired_outcome": "<string>",
"horizon_at": "2023-11-07T05:31:56Z",
"max_value": 123,
"min_value": 123,
"success_criteria": [
"<string>"
],
"target_value": 123,
"title": "<string>",
"unit": "<string>",
"why_it_matters": "<string>"
}
'import requests
url = "https://api.omi.me/v1/dev/user/goals/{goal_id}"
payload = {
"current_value": 123,
"desired_outcome": "<string>",
"horizon_at": "2023-11-07T05:31:56Z",
"max_value": 123,
"min_value": 123,
"success_criteria": ["<string>"],
"target_value": 123,
"title": "<string>",
"unit": "<string>",
"why_it_matters": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
current_value: 123,
desired_outcome: '<string>',
horizon_at: '2023-11-07T05:31:56Z',
max_value: 123,
min_value: 123,
success_criteria: ['<string>'],
target_value: 123,
title: '<string>',
unit: '<string>',
why_it_matters: '<string>'
})
};
fetch('https://api.omi.me/v1/dev/user/goals/{goal_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://api.omi.me/v1/dev/user/goals/{goal_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([
'current_value' => 123,
'desired_outcome' => '<string>',
'horizon_at' => '2023-11-07T05:31:56Z',
'max_value' => 123,
'min_value' => 123,
'success_criteria' => [
'<string>'
],
'target_value' => 123,
'title' => '<string>',
'unit' => '<string>',
'why_it_matters' => '<string>'
]),
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://api.omi.me/v1/dev/user/goals/{goal_id}"
payload := strings.NewReader("{\n \"current_value\": 123,\n \"desired_outcome\": \"<string>\",\n \"horizon_at\": \"2023-11-07T05:31:56Z\",\n \"max_value\": 123,\n \"min_value\": 123,\n \"success_criteria\": [\n \"<string>\"\n ],\n \"target_value\": 123,\n \"title\": \"<string>\",\n \"unit\": \"<string>\",\n \"why_it_matters\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.omi.me/v1/dev/user/goals/{goal_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"current_value\": 123,\n \"desired_outcome\": \"<string>\",\n \"horizon_at\": \"2023-11-07T05:31:56Z\",\n \"max_value\": 123,\n \"min_value\": 123,\n \"success_criteria\": [\n \"<string>\"\n ],\n \"target_value\": 123,\n \"title\": \"<string>\",\n \"unit\": \"<string>\",\n \"why_it_matters\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.omi.me/v1/dev/user/goals/{goal_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"current_value\": 123,\n \"desired_outcome\": \"<string>\",\n \"horizon_at\": \"2023-11-07T05:31:56Z\",\n \"max_value\": 123,\n \"min_value\": 123,\n \"success_criteria\": [\n \"<string>\"\n ],\n \"target_value\": 123,\n \"title\": \"<string>\",\n \"unit\": \"<string>\",\n \"why_it_matters\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2023-11-07T05:31:56Z",
"current_value": 123,
"desired_outcome": "<string>",
"goal_id": "<string>",
"goal_type": "<string>",
"id": "<string>",
"is_active": true,
"max_value": 123,
"min_value": 123,
"source": "<string>",
"status": "<string>",
"target_value": 123,
"title": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"focus_rank": 123,
"horizon_at": "2023-11-07T05:31:56Z",
"metric": {
"current": 123,
"target": 123,
"max": 123,
"min": 123,
"unit": "<string>"
},
"success_criteria": [
"<string>"
],
"unit": "<string>",
"why_it_matters": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Goals
Update Goal
Update a goal.
- goal_id: The ID of the goal to update
- title: New title (optional)
- target_value: New target value (optional)
- current_value: New progress value (optional)
- min_value: New minimum value (optional)
- max_value: New maximum value (optional)
- unit: New unit label (optional)
PATCH
/
v1
/
dev
/
user
/
goals
/
{goal_id}
Update Goal
curl --request PATCH \
--url https://api.omi.me/v1/dev/user/goals/{goal_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"current_value": 123,
"desired_outcome": "<string>",
"horizon_at": "2023-11-07T05:31:56Z",
"max_value": 123,
"min_value": 123,
"success_criteria": [
"<string>"
],
"target_value": 123,
"title": "<string>",
"unit": "<string>",
"why_it_matters": "<string>"
}
'import requests
url = "https://api.omi.me/v1/dev/user/goals/{goal_id}"
payload = {
"current_value": 123,
"desired_outcome": "<string>",
"horizon_at": "2023-11-07T05:31:56Z",
"max_value": 123,
"min_value": 123,
"success_criteria": ["<string>"],
"target_value": 123,
"title": "<string>",
"unit": "<string>",
"why_it_matters": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
current_value: 123,
desired_outcome: '<string>',
horizon_at: '2023-11-07T05:31:56Z',
max_value: 123,
min_value: 123,
success_criteria: ['<string>'],
target_value: 123,
title: '<string>',
unit: '<string>',
why_it_matters: '<string>'
})
};
fetch('https://api.omi.me/v1/dev/user/goals/{goal_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://api.omi.me/v1/dev/user/goals/{goal_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([
'current_value' => 123,
'desired_outcome' => '<string>',
'horizon_at' => '2023-11-07T05:31:56Z',
'max_value' => 123,
'min_value' => 123,
'success_criteria' => [
'<string>'
],
'target_value' => 123,
'title' => '<string>',
'unit' => '<string>',
'why_it_matters' => '<string>'
]),
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://api.omi.me/v1/dev/user/goals/{goal_id}"
payload := strings.NewReader("{\n \"current_value\": 123,\n \"desired_outcome\": \"<string>\",\n \"horizon_at\": \"2023-11-07T05:31:56Z\",\n \"max_value\": 123,\n \"min_value\": 123,\n \"success_criteria\": [\n \"<string>\"\n ],\n \"target_value\": 123,\n \"title\": \"<string>\",\n \"unit\": \"<string>\",\n \"why_it_matters\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.omi.me/v1/dev/user/goals/{goal_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"current_value\": 123,\n \"desired_outcome\": \"<string>\",\n \"horizon_at\": \"2023-11-07T05:31:56Z\",\n \"max_value\": 123,\n \"min_value\": 123,\n \"success_criteria\": [\n \"<string>\"\n ],\n \"target_value\": 123,\n \"title\": \"<string>\",\n \"unit\": \"<string>\",\n \"why_it_matters\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.omi.me/v1/dev/user/goals/{goal_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"current_value\": 123,\n \"desired_outcome\": \"<string>\",\n \"horizon_at\": \"2023-11-07T05:31:56Z\",\n \"max_value\": 123,\n \"min_value\": 123,\n \"success_criteria\": [\n \"<string>\"\n ],\n \"target_value\": 123,\n \"title\": \"<string>\",\n \"unit\": \"<string>\",\n \"why_it_matters\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2023-11-07T05:31:56Z",
"current_value": 123,
"desired_outcome": "<string>",
"goal_id": "<string>",
"goal_type": "<string>",
"id": "<string>",
"is_active": true,
"max_value": 123,
"min_value": 123,
"source": "<string>",
"status": "<string>",
"target_value": 123,
"title": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"focus_rank": 123,
"horizon_at": "2023-11-07T05:31:56Z",
"metric": {
"current": 123,
"target": 123,
"max": 123,
"min": 123,
"unit": "<string>"
},
"success_criteria": [
"<string>"
],
"unit": "<string>",
"why_it_matters": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Send Authorization: Bearer <omi_developer_api_key>.
Path Parameters
Body
application/json
New progress value
Maximum string length:
2000New maximum value
New minimum value
Maximum array length:
20New target value
New title
Required string length:
1 - 500New unit label
Maximum string length:
2000Response
Successful Response
Show child attributes
Show child attributes
⌘I