Update an org-scoped metric definition
curl --request PATCH \
--url https://app.solya.app/api/intelligence-layer/metrics/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"displayName": "Total Sold Qty (updated)",
"grain": [
"shop_id",
"variant_id",
"size_id"
]
}
'import requests
url = "https://app.solya.app/api/intelligence-layer/metrics/{id}"
payload = {
"displayName": "Total Sold Qty (updated)",
"grain": ["shop_id", "variant_id", "size_id"]
}
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({
displayName: 'Total Sold Qty (updated)',
grain: ['shop_id', 'variant_id', 'size_id']
})
};
fetch('https://app.solya.app/api/intelligence-layer/metrics/{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.solya.app/api/intelligence-layer/metrics/{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([
'displayName' => 'Total Sold Qty (updated)',
'grain' => [
'shop_id',
'variant_id',
'size_id'
]
]),
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.solya.app/api/intelligence-layer/metrics/{id}"
payload := strings.NewReader("{\n \"displayName\": \"Total Sold Qty (updated)\",\n \"grain\": [\n \"shop_id\",\n \"variant_id\",\n \"size_id\"\n ]\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://app.solya.app/api/intelligence-layer/metrics/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"displayName\": \"Total Sold Qty (updated)\",\n \"grain\": [\n \"shop_id\",\n \"variant_id\",\n \"size_id\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.solya.app/api/intelligence-layer/metrics/{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 \"displayName\": \"Total Sold Qty (updated)\",\n \"grain\": [\n \"shop_id\",\n \"variant_id\",\n \"size_id\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true
}Metrics
Update an org-scoped metric definition
Patches an existing ORG-scoped metric definition in the caller’s organization. All body fields are optional — only the provided fields are updated. The body field, when supplied, must be a complete valid discriminated-union metric body (not a partial diff). Returns 404 when the metric does not exist, is GLOBAL (not owned by any org), or belongs to another organization. Requires intelligenceLayer.configure permission.
PATCH
/
api
/
intelligence-layer
/
metrics
/
{id}
Update an org-scoped metric definition
curl --request PATCH \
--url https://app.solya.app/api/intelligence-layer/metrics/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"displayName": "Total Sold Qty (updated)",
"grain": [
"shop_id",
"variant_id",
"size_id"
]
}
'import requests
url = "https://app.solya.app/api/intelligence-layer/metrics/{id}"
payload = {
"displayName": "Total Sold Qty (updated)",
"grain": ["shop_id", "variant_id", "size_id"]
}
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({
displayName: 'Total Sold Qty (updated)',
grain: ['shop_id', 'variant_id', 'size_id']
})
};
fetch('https://app.solya.app/api/intelligence-layer/metrics/{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.solya.app/api/intelligence-layer/metrics/{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([
'displayName' => 'Total Sold Qty (updated)',
'grain' => [
'shop_id',
'variant_id',
'size_id'
]
]),
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.solya.app/api/intelligence-layer/metrics/{id}"
payload := strings.NewReader("{\n \"displayName\": \"Total Sold Qty (updated)\",\n \"grain\": [\n \"shop_id\",\n \"variant_id\",\n \"size_id\"\n ]\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://app.solya.app/api/intelligence-layer/metrics/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"displayName\": \"Total Sold Qty (updated)\",\n \"grain\": [\n \"shop_id\",\n \"variant_id\",\n \"size_id\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.solya.app/api/intelligence-layer/metrics/{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 \"displayName\": \"Total Sold Qty (updated)\",\n \"grain\": [\n \"shop_id\",\n \"variant_id\",\n \"size_id\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true
}Authorizations
User session token issued by NextAuth. For human users accessing Solya via the web application.
Path Parameters
Unique identifier of the metric (UUID)
Minimum string length:
1Body
application/json
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
Show child attributes
Show child attributes
Minimum string length:
1Show child attributes
Show child attributes
Minimum array length:
1Minimum string length:
1Required string length:
1 - 255Required string length:
1 - 255
