curl --request PATCH \
--url https://api.dune.com/api/v1/query/{queryId} \
--header 'Content-Type: application/json' \
--header 'X-DUNE-API-KEY: <x-dune-api-key>' \
--data '{
"query_id": 1252207,
"query_sql": "SELECT * FROM {{blockchain}}.transactions WHERE to = {{address}} AND block_number > {{blocknumber}}",
}'
from dune_client.types import QueryParameter
from dune_client.client import DuneClient
from dune_client.query import QueryBase
dune = DuneClient()
query = dune.update_query(
query_sql="SELECT * FROM {{blockchain}}.transactions WHERE to = {{address}} AND block_number > {{blocknumber}}"
)
curl --request PATCH \
--url https://api.dune.com/api/v1/query/{queryId} \
--header 'Content-Type: application/json' \
--header 'X-DUNE-API-KEY: <x-dune-api-key>' \
--data '{
"query_id": 1252207,
"query_sql": "{{blockchain}}.transactions WHERE to = {{address}} AND block_number > {{blocknumber}}"
}'
const options = {
method: 'PATCH',
headers: {'X-DUNE-API-KEY': '<x-dune-api-key>', 'Content-Type': 'application/json'},
body: '{"query_id":1252207,"query_sql":"{{blockchain}}.transactions WHERE to = {{address}} AND block_number > {{blocknumber}}"}'
};
fetch('https://api.dune.com/api/v1/query/{queryId}', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.dune.com/api/v1/query/{queryId}"
payload := strings.NewReader("{\n \"query_id\": 1252207,\n ,\n \"query_sql\": \"{{blockchain}}.transactions WHERE to = {{address}} AND block_number > {{blocknumber}}\"}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-DUNE-API-KEY", "<x-dune-api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.dune.com/api/v1/query/{queryId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => "{\n \"query_id\": 1252207,\n \"query_sql\": \"{{blockchain}}.transactions WHERE to = {{address}} AND block_number > {{blocknumber}}\"}",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-DUNE-API-KEY: <x-dune-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
HttpResponse<String> response = Unirest.patch("https://api.dune.com/api/v1/query/{queryId}")
.header("X-DUNE-API-KEY", "<x-dune-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"query_id\": 1252207,\n \"query_sql\": \"{{blockchain}}.transactions WHERE to = {{address}} AND block_number > {{blocknumber}}\"}")
.asString();
{
"query_id": 123
}{
"error": "Bad Request"
}{
"error": "Invalid API Key"
}{
"error": "This API request would exceed your configured limits per billing cycle."
}{
"error": "Not allowed to execute query. Query is archived, unsaved or not enough permissions"
}{
"error": "Object not found"
}{
"error": "Internal error"
}Query Management
Update Query
This API allows for anyone to update the sql text, parameters, name, tags, and state of a query. Only the API key generated under the context of the owner of that query will work.
PATCH
/
v1
/
query
/
{queryId}
curl --request PATCH \
--url https://api.dune.com/api/v1/query/{queryId} \
--header 'Content-Type: application/json' \
--header 'X-DUNE-API-KEY: <x-dune-api-key>' \
--data '{
"query_id": 1252207,
"query_sql": "SELECT * FROM {{blockchain}}.transactions WHERE to = {{address}} AND block_number > {{blocknumber}}",
}'
from dune_client.types import QueryParameter
from dune_client.client import DuneClient
from dune_client.query import QueryBase
dune = DuneClient()
query = dune.update_query(
query_sql="SELECT * FROM {{blockchain}}.transactions WHERE to = {{address}} AND block_number > {{blocknumber}}"
)
curl --request PATCH \
--url https://api.dune.com/api/v1/query/{queryId} \
--header 'Content-Type: application/json' \
--header 'X-DUNE-API-KEY: <x-dune-api-key>' \
--data '{
"query_id": 1252207,
"query_sql": "{{blockchain}}.transactions WHERE to = {{address}} AND block_number > {{blocknumber}}"
}'
const options = {
method: 'PATCH',
headers: {'X-DUNE-API-KEY': '<x-dune-api-key>', 'Content-Type': 'application/json'},
body: '{"query_id":1252207,"query_sql":"{{blockchain}}.transactions WHERE to = {{address}} AND block_number > {{blocknumber}}"}'
};
fetch('https://api.dune.com/api/v1/query/{queryId}', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.dune.com/api/v1/query/{queryId}"
payload := strings.NewReader("{\n \"query_id\": 1252207,\n ,\n \"query_sql\": \"{{blockchain}}.transactions WHERE to = {{address}} AND block_number > {{blocknumber}}\"}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-DUNE-API-KEY", "<x-dune-api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.dune.com/api/v1/query/{queryId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => "{\n \"query_id\": 1252207,\n \"query_sql\": \"{{blockchain}}.transactions WHERE to = {{address}} AND block_number > {{blocknumber}}\"}",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-DUNE-API-KEY: <x-dune-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
HttpResponse<String> response = Unirest.patch("https://api.dune.com/api/v1/query/{queryId}")
.header("X-DUNE-API-KEY", "<x-dune-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"query_id\": 1252207,\n \"query_sql\": \"{{blockchain}}.transactions WHERE to = {{address}} AND block_number > {{blocknumber}}\"}")
.asString();
{
"query_id": 123
}{
"error": "Bad Request"
}{
"error": "Invalid API Key"
}{
"error": "This API request would exceed your configured limits per billing cycle."
}{
"error": "Not allowed to execute query. Query is archived, unsaved or not enough permissions"
}{
"error": "Object not found"
}{
"error": "Internal error"
}Minimum required API key scope:
Read/WriteTo access Query endpoints, an Analyst plan or higher is required.
curl --request PATCH \
--url https://api.dune.com/api/v1/query/{queryId} \
--header 'Content-Type: application/json' \
--header 'X-DUNE-API-KEY: <x-dune-api-key>' \
--data '{
"query_id": 1252207,
"query_sql": "SELECT * FROM {{blockchain}}.transactions WHERE to = {{address}} AND block_number > {{blocknumber}}",
}'
from dune_client.types import QueryParameter
from dune_client.client import DuneClient
from dune_client.query import QueryBase
dune = DuneClient()
query = dune.update_query(
query_sql="SELECT * FROM {{blockchain}}.transactions WHERE to = {{address}} AND block_number > {{blocknumber}}"
)
curl --request PATCH \
--url https://api.dune.com/api/v1/query/{queryId} \
--header 'Content-Type: application/json' \
--header 'X-DUNE-API-KEY: <x-dune-api-key>' \
--data '{
"query_id": 1252207,
"query_sql": "{{blockchain}}.transactions WHERE to = {{address}} AND block_number > {{blocknumber}}"
}'
const options = {
method: 'PATCH',
headers: {'X-DUNE-API-KEY': '<x-dune-api-key>', 'Content-Type': 'application/json'},
body: '{"query_id":1252207,"query_sql":"{{blockchain}}.transactions WHERE to = {{address}} AND block_number > {{blocknumber}}"}'
};
fetch('https://api.dune.com/api/v1/query/{queryId}', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.dune.com/api/v1/query/{queryId}"
payload := strings.NewReader("{\n \"query_id\": 1252207,\n ,\n \"query_sql\": \"{{blockchain}}.transactions WHERE to = {{address}} AND block_number > {{blocknumber}}\"}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-DUNE-API-KEY", "<x-dune-api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.dune.com/api/v1/query/{queryId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => "{\n \"query_id\": 1252207,\n \"query_sql\": \"{{blockchain}}.transactions WHERE to = {{address}} AND block_number > {{blocknumber}}\"}",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-DUNE-API-KEY: <x-dune-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
HttpResponse<String> response = Unirest.patch("https://api.dune.com/api/v1/query/{queryId}")
.header("X-DUNE-API-KEY", "<x-dune-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"query_id\": 1252207,\n \"query_sql\": \"{{blockchain}}.transactions WHERE to = {{address}} AND block_number > {{blocknumber}}\"}")
.asString();
Was this page helpful?
⌘I