Update
curl --request PATCH \
--url https://devx.{environment}.oleria.io/v1/query/saved-queries/{query_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expected_version": 3,
"name": "Disabled MFA — prod",
"description": "<string>",
"query_string": "<string>",
"model": "oleria_identity"
}
'import requests
url = "https://devx.{environment}.oleria.io/v1/query/saved-queries/{query_id}"
payload = {
"expected_version": 3,
"name": "Disabled MFA — prod",
"description": "<string>",
"query_string": "<string>",
"model": "oleria_identity"
}
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({
expected_version: 3,
name: 'Disabled MFA — prod',
description: '<string>',
query_string: '<string>',
model: 'oleria_identity'
})
};
fetch('https://devx.{environment}.oleria.io/v1/query/saved-queries/{query_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://devx.{environment}.oleria.io/v1/query/saved-queries/{query_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([
'expected_version' => 3,
'name' => 'Disabled MFA — prod',
'description' => '<string>',
'query_string' => '<string>',
'model' => 'oleria_identity'
]),
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://devx.{environment}.oleria.io/v1/query/saved-queries/{query_id}"
payload := strings.NewReader("{\n \"expected_version\": 3,\n \"name\": \"Disabled MFA — prod\",\n \"description\": \"<string>\",\n \"query_string\": \"<string>\",\n \"model\": \"oleria_identity\"\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://devx.{environment}.oleria.io/v1/query/saved-queries/{query_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"expected_version\": 3,\n \"name\": \"Disabled MFA — prod\",\n \"description\": \"<string>\",\n \"query_string\": \"<string>\",\n \"model\": \"oleria_identity\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://devx.{environment}.oleria.io/v1/query/saved-queries/{query_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 \"expected_version\": 3,\n \"name\": \"Disabled MFA — prod\",\n \"description\": \"<string>\",\n \"query_string\": \"<string>\",\n \"model\": \"oleria_identity\"\n}"
response = http.request(request)
puts response.read_body{
"query_id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Disabled MFA accounts",
"query_string": "SELECT account_id, mfa_status FROM oleria_account WHERE mfa_status = :status",
"model": "oleria_identity",
"created_by": {
"type": "user",
"id": "ol_a1b2c3d4-e5f6-7890-abcd-ef1234567890"
},
"last_modified_by": {
"type": "user",
"id": "ol_a1b2c3d4-e5f6-7890-abcd-ef1234567890"
},
"version": 3,
"created_at": "2026-06-01T10:00:00Z",
"last_modified_at": "2026-06-04T09:30:00Z",
"description": "Accounts where MFA is disabled — weekly review"
}Saved Query
Update
Partial update with optimistic concurrency. The caller sends the expected_version it last read; a mismatch returns 409 VERSION_CONFLICT. On success version is incremented and last_modified_by / last_modified_at are set.
PATCH
/
v1
/
query
/
saved-queries
/
{query_id}
Update
curl --request PATCH \
--url https://devx.{environment}.oleria.io/v1/query/saved-queries/{query_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expected_version": 3,
"name": "Disabled MFA — prod",
"description": "<string>",
"query_string": "<string>",
"model": "oleria_identity"
}
'import requests
url = "https://devx.{environment}.oleria.io/v1/query/saved-queries/{query_id}"
payload = {
"expected_version": 3,
"name": "Disabled MFA — prod",
"description": "<string>",
"query_string": "<string>",
"model": "oleria_identity"
}
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({
expected_version: 3,
name: 'Disabled MFA — prod',
description: '<string>',
query_string: '<string>',
model: 'oleria_identity'
})
};
fetch('https://devx.{environment}.oleria.io/v1/query/saved-queries/{query_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://devx.{environment}.oleria.io/v1/query/saved-queries/{query_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([
'expected_version' => 3,
'name' => 'Disabled MFA — prod',
'description' => '<string>',
'query_string' => '<string>',
'model' => 'oleria_identity'
]),
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://devx.{environment}.oleria.io/v1/query/saved-queries/{query_id}"
payload := strings.NewReader("{\n \"expected_version\": 3,\n \"name\": \"Disabled MFA — prod\",\n \"description\": \"<string>\",\n \"query_string\": \"<string>\",\n \"model\": \"oleria_identity\"\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://devx.{environment}.oleria.io/v1/query/saved-queries/{query_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"expected_version\": 3,\n \"name\": \"Disabled MFA — prod\",\n \"description\": \"<string>\",\n \"query_string\": \"<string>\",\n \"model\": \"oleria_identity\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://devx.{environment}.oleria.io/v1/query/saved-queries/{query_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 \"expected_version\": 3,\n \"name\": \"Disabled MFA — prod\",\n \"description\": \"<string>\",\n \"query_string\": \"<string>\",\n \"model\": \"oleria_identity\"\n}"
response = http.request(request)
puts response.read_body{
"query_id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Disabled MFA accounts",
"query_string": "SELECT account_id, mfa_status FROM oleria_account WHERE mfa_status = :status",
"model": "oleria_identity",
"created_by": {
"type": "user",
"id": "ol_a1b2c3d4-e5f6-7890-abcd-ef1234567890"
},
"last_modified_by": {
"type": "user",
"id": "ol_a1b2c3d4-e5f6-7890-abcd-ef1234567890"
},
"version": 3,
"created_at": "2026-06-01T10:00:00Z",
"last_modified_at": "2026-06-04T09:30:00Z",
"description": "Accounts where MFA is disabled — weekly review"
}Authorizations
Scopes
Body
application/json
Partial update. expected_version must equal the query's current version (optimistic concurrency); a mismatch returns 409 VERSION_CONFLICT. Omitted fields are left unchanged.
Response
The updated saved query.
A stored SQL query with authorship metadata.
Was this page helpful?

