getBlockByHeight Query
Parameter
Höhe
Zeichenkette
ERFORDERLICH
Wird geladen...
Rücksendungen
Daten
Objekt
Wird geladen...
Block
Objekt
Wird geladen...
id
Zeichenkette
Wird geladen...
Anfrage
1curl --location 'https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql' \2--header 'Accept: application/json' \3--header 'Content-Type: application/json' \4--Daten '{5"query": "query Block($height: U64) { block(height: $height) { id } }",6"variables": {7"height": "3412"8}9}'
1curl --location 'https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql' \2--header 'Accept: application/json' \3--header 'Content-Type: application/json' \4--Daten '{5"query": "query Block($height: U64) { block(height: $height) { id } }",6"variables": {7"height": "3412"8}9}'
1const BLOCK_QUERY = `2query Block($height: U64) {3block(height: $height) {4id5}6}7`;89const QUERY_VARIABLES = {10height: '3412',11};1213const fetchBlockByHeight = async () => {14try {15const response = await fetch('https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql', {16method: 'POST',17headers: {18'Accept': 'application/json',19'Content-Type': 'application/json',20},21body: JSON.stringify({22query: BLOCK_QUERY,23variables: QUERY_VARIABLES,24}),25});2627if (!response.ok) {28throw new Error(`HTTP error! status: ${response.status}`);29}3031const result = await response.json();32console.log('Block ID:', result.data.block.id);33} catch (error) {34console.error('Error fetching block:', error);35}36};3738fetchBlockByHeight();39
1const BLOCK_QUERY = `2query Block($height: U64) {3block(height: $height) {4id5}6}7`;89const QUERY_VARIABLES = {10height: '3412',11};1213const fetchBlockByHeight = async () => {14try {15const response = await fetch('https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql', {16method: 'POST',17headers: {18'Accept': 'application/json',19'Content-Type': 'application/json',20},21body: JSON.stringify({22query: BLOCK_QUERY,23variables: QUERY_VARIABLES,24}),25});2627if (!response.ok) {28throw new Error(`HTTP error! status: ${response.status}`);29}3031const result = await response.json();32console.log('Block ID:', result.data.block.id);33} catch (error) {34console.error('Error fetching block:', error);35}36};3738fetchBlockByHeight();39
1const myHeaders = new Headers();2myHeaders.anhängen("Accept", "application/json");3myHeaders.anhängen("Content-Type", "application/json");45const raw = JSON.stringify({6"query": "query Block($height: U64) { block(height: $height) { id } }",7"variables": {8"height": "3412"9}10});1112const requestOptions = {13Methode: „POST“,14Überschriften: myHeaders,15Körper: raw,16Weiterleitung: „follow“17};1819fetch("https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql", requestOptions)20.dann((Antwort) => Antwort.text())21.dann((Ergebnis) => Konsole.log(Ergebnis))22.catch((Fehler) => Konsole.Fehler(Fehler));
1const myHeaders = new Headers();2myHeaders.anhängen("Accept", "application/json");3myHeaders.anhängen("Content-Type", "application/json");45const raw = JSON.stringify({6"query": "query Block($height: U64) { block(height: $height) { id } }",7"variables": {8"height": "3412"9}10});1112const requestOptions = {13Methode: „POST“,14Überschriften: myHeaders,15Körper: raw,16Weiterleitung: „follow“17};1819fetch("https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql", requestOptions)20.dann((Antwort) => Antwort.text())21.dann((Ergebnis) => Konsole.log(Ergebnis))22.catch((Fehler) => Konsole.Fehler(Fehler));
1const { ApolloClient, InMemoryCache, gql } = require('@apollo/client/core');2const fetch = require('cross-fetch');34const client = new ApolloClient({5uri: 'https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql',6cache: new InMemoryCache(),7fetch: fetch,8headers: {9'Accept': 'application/json',10'Content-Type': 'application/json'11}12});1314const BLOCK_BY_HEIGHT_QUERY = gql`15query Block($height: U64) {16block(height: $height) {17id18}19}20`;2122const variables = {23height: "3412"24};2526client.query({27query: BLOCK_BY_HEIGHT_QUERY,28variables: variables29})30.then(result => {31console.log(JSON.stringify(result.data, null, 2));32})33.catch(error => console.error('Error:', error));
1const { ApolloClient, InMemoryCache, gql } = require('@apollo/client/core');2const fetch = require('cross-fetch');34const client = new ApolloClient({5uri: 'https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql',6cache: new InMemoryCache(),7fetch: fetch,8headers: {9'Accept': 'application/json',10'Content-Type': 'application/json'11}12});1314const BLOCK_BY_HEIGHT_QUERY = gql`15query Block($height: U64) {16block(height: $height) {17id18}19}20`;2122const variables = {23height: "3412"24};2526client.query({27query: BLOCK_BY_HEIGHT_QUERY,28variables: variables29})30.then(result => {31console.log(JSON.stringify(result.data, null, 2));32})33.catch(error => console.error('Error:', error));
1import Anfragen2import json34url = "https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql"56Nutzlast = json.dumps({7"query": "query Block($height: U64) { block(height: $height) { id } }",8"variables": {9"height": "3412"10}11})12Überschriften = {13„Akzeptieren“: 'application/json',14„Content-Type“: 'application/json'15}1617Antwort = Anfragen.Anfrage("POST", url, headers=headers, Daten=Nutzdaten)1819Drucken(Antwort.text)20
1import Anfragen2import json34url = "https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql"56Nutzlast = json.dumps({7"query": "query Block($height: U64) { block(height: $height) { id } }",8"variables": {9"height": "3412"10}11})12Überschriften = {13„Akzeptieren“: 'application/json',14„Content-Type“: 'application/json'15}1617Antwort = Anfragen.Anfrage("POST", url, headers=headers, Daten=Nutzdaten)1819Drucken(Antwort.text)20
1require "uri"2require "json"3require „net/http“45url = URI("https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql")67https = Net::HTTP.new(url.host, URL.Port)8https.use_ssl = true910Anfrage = Netto::HTTP::POST.new(URL)11Anfrage[„Akzeptieren“] = „application/json“12Anfrage[„Content-Type“] = „application/json“13Anfrage.Inhalt = JSON.dump({14"query": "query Block(\$height: U64) { block(height: \$height) { id } }",15"variables": {16"height": "3412"17}18})1920Antwort = https.Anfrage(Anfrage)21gibt die Antwort aus.read_body22
1require "uri"2require "json"3require „net/http“45url = URI("https://docs-demo.fuel-mainnet.quiknode.pro/v1/graphql")67https = Net::HTTP.new(url.host, URL.Port)8https.use_ssl = true910Anfrage = Netto::HTTP::POST.new(URL)11Anfrage[„Akzeptieren“] = „application/json“12Anfrage[„Content-Type“] = „application/json“13Anfrage.Inhalt = JSON.dump({14"query": "query Block(\$height: U64) { block(height: \$height) { id } }",15"variables": {16"height": "3412"17}18})1920Antwort = https.Anfrage(Anfrage)21gibt die Antwort aus.read_body22
Haben Sie noch kein Konto?
Erstellen Sie Ihren Quicknode-Endpunkt in Sekundenschnelle und legen Sie los
Kostenlos loslegen