Update target
curl --request PUT \
--url https://app.azalt.co/api/v1/targets/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "<string>",
"baselineYear": 123,
"baselineMonth": 123,
"baselineQuarter": 123,
"metadata": {},
"targetEntries": [
{
"year": 123,
"targetValue": 123,
"siteId": "<string>",
"month": 123,
"quarter": 123
}
]
}
'import requests
url = "https://app.azalt.co/api/v1/targets/{id}"
payload = {
"title": "<string>",
"baselineYear": 123,
"baselineMonth": 123,
"baselineQuarter": 123,
"metadata": {},
"targetEntries": [
{
"year": 123,
"targetValue": 123,
"siteId": "<string>",
"month": 123,
"quarter": 123
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: '<string>',
baselineYear: 123,
baselineMonth: 123,
baselineQuarter: 123,
metadata: {},
targetEntries: [{year: 123, targetValue: 123, siteId: '<string>', month: 123, quarter: 123}]
})
};
fetch('https://app.azalt.co/api/v1/targets/{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.azalt.co/api/v1/targets/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'title' => '<string>',
'baselineYear' => 123,
'baselineMonth' => 123,
'baselineQuarter' => 123,
'metadata' => [
],
'targetEntries' => [
[
'year' => 123,
'targetValue' => 123,
'siteId' => '<string>',
'month' => 123,
'quarter' => 123
]
]
]),
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.azalt.co/api/v1/targets/{id}"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"baselineYear\": 123,\n \"baselineMonth\": 123,\n \"baselineQuarter\": 123,\n \"metadata\": {},\n \"targetEntries\": [\n {\n \"year\": 123,\n \"targetValue\": 123,\n \"siteId\": \"<string>\",\n \"month\": 123,\n \"quarter\": 123\n }\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://app.azalt.co/api/v1/targets/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"baselineYear\": 123,\n \"baselineMonth\": 123,\n \"baselineQuarter\": 123,\n \"metadata\": {},\n \"targetEntries\": [\n {\n \"year\": 123,\n \"targetValue\": 123,\n \"siteId\": \"<string>\",\n \"month\": 123,\n \"quarter\": 123\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.azalt.co/api/v1/targets/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"<string>\",\n \"baselineYear\": 123,\n \"baselineMonth\": 123,\n \"baselineQuarter\": 123,\n \"metadata\": {},\n \"targetEntries\": [\n {\n \"year\": 123,\n \"targetValue\": 123,\n \"siteId\": \"<string>\",\n \"month\": 123,\n \"quarter\": 123\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"indicatorId": "<string>",
"organizationId": "<string>",
"title": "<string>",
"baselineYear": 123,
"baselineMonth": 123,
"baselineQuarter": 123,
"metadata": {},
"targetEntries": [
{
"year": 123,
"targetValue": 123,
"siteId": "<string>",
"month": 123,
"quarter": 123
}
],
"createdAt": "<string>",
"updatedAt": "<string>"
}{
"code": "BAD_REQUEST",
"message": "Invalid input data",
"issues": []
}{
"code": "UNAUTHORIZED",
"message": "Authorization not provided",
"issues": []
}{
"code": "FORBIDDEN",
"message": "Insufficient access",
"issues": []
}{
"code": "NOT_FOUND",
"message": "Not found",
"issues": []
}{
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error",
"issues": []
}Target
Update target
Update an existing target’s properties and target entries.
Updatable Fields:
title: Change the target namebaselineYear/Month/Quarter: Modify the reference periodmetadata: Update custom metadata for external integrationtargetEntries: Replace all target entries with new values, periods, and types
All fields are optional - only provided fields will be updated. Target entries are completely replaced when provided.
PUT
/
targets
/
{id}
Update target
curl --request PUT \
--url https://app.azalt.co/api/v1/targets/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "<string>",
"baselineYear": 123,
"baselineMonth": 123,
"baselineQuarter": 123,
"metadata": {},
"targetEntries": [
{
"year": 123,
"targetValue": 123,
"siteId": "<string>",
"month": 123,
"quarter": 123
}
]
}
'import requests
url = "https://app.azalt.co/api/v1/targets/{id}"
payload = {
"title": "<string>",
"baselineYear": 123,
"baselineMonth": 123,
"baselineQuarter": 123,
"metadata": {},
"targetEntries": [
{
"year": 123,
"targetValue": 123,
"siteId": "<string>",
"month": 123,
"quarter": 123
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: '<string>',
baselineYear: 123,
baselineMonth: 123,
baselineQuarter: 123,
metadata: {},
targetEntries: [{year: 123, targetValue: 123, siteId: '<string>', month: 123, quarter: 123}]
})
};
fetch('https://app.azalt.co/api/v1/targets/{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.azalt.co/api/v1/targets/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'title' => '<string>',
'baselineYear' => 123,
'baselineMonth' => 123,
'baselineQuarter' => 123,
'metadata' => [
],
'targetEntries' => [
[
'year' => 123,
'targetValue' => 123,
'siteId' => '<string>',
'month' => 123,
'quarter' => 123
]
]
]),
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.azalt.co/api/v1/targets/{id}"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"baselineYear\": 123,\n \"baselineMonth\": 123,\n \"baselineQuarter\": 123,\n \"metadata\": {},\n \"targetEntries\": [\n {\n \"year\": 123,\n \"targetValue\": 123,\n \"siteId\": \"<string>\",\n \"month\": 123,\n \"quarter\": 123\n }\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://app.azalt.co/api/v1/targets/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"baselineYear\": 123,\n \"baselineMonth\": 123,\n \"baselineQuarter\": 123,\n \"metadata\": {},\n \"targetEntries\": [\n {\n \"year\": 123,\n \"targetValue\": 123,\n \"siteId\": \"<string>\",\n \"month\": 123,\n \"quarter\": 123\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.azalt.co/api/v1/targets/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"<string>\",\n \"baselineYear\": 123,\n \"baselineMonth\": 123,\n \"baselineQuarter\": 123,\n \"metadata\": {},\n \"targetEntries\": [\n {\n \"year\": 123,\n \"targetValue\": 123,\n \"siteId\": \"<string>\",\n \"month\": 123,\n \"quarter\": 123\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"indicatorId": "<string>",
"organizationId": "<string>",
"title": "<string>",
"baselineYear": 123,
"baselineMonth": 123,
"baselineQuarter": 123,
"metadata": {},
"targetEntries": [
{
"year": 123,
"targetValue": 123,
"siteId": "<string>",
"month": 123,
"quarter": 123
}
],
"createdAt": "<string>",
"updatedAt": "<string>"
}{
"code": "BAD_REQUEST",
"message": "Invalid input data",
"issues": []
}{
"code": "UNAUTHORIZED",
"message": "Authorization not provided",
"issues": []
}{
"code": "FORBIDDEN",
"message": "Insufficient access",
"issues": []
}{
"code": "NOT_FOUND",
"message": "Not found",
"issues": []
}{
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error",
"issues": []
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
application/json
Response
Successful response
Show child attributes
Show child attributes
Show child attributes
Show child attributes
⌘I

