Topics
Get Topic Message by ID & Sequence
Returns a single topic message the given topic id and sequence number.
GET
/
api
/
v1
/
topics
/
{topicId}
/
messages
/
{sequenceNumber}
Get topic message by id and sequence number
curl --request GET \
--url https://{network}.hedera.validationcloud.io/v1/{API_KEY}/api/v1/topics/{topicId}/messages/{sequenceNumber}import requests
url = "https://{network}.hedera.validationcloud.io/v1/{API_KEY}/api/v1/topics/{topicId}/messages/{sequenceNumber}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://{network}.hedera.validationcloud.io/v1/{API_KEY}/api/v1/topics/{topicId}/messages/{sequenceNumber}', 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://{network}.hedera.validationcloud.io/v1/{API_KEY}/api/v1/topics/{topicId}/messages/{sequenceNumber}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{network}.hedera.validationcloud.io/v1/{API_KEY}/api/v1/topics/{topicId}/messages/{sequenceNumber}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{network}.hedera.validationcloud.io/v1/{API_KEY}/api/v1/topics/{topicId}/messages/{sequenceNumber}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{network}.hedera.validationcloud.io/v1/{API_KEY}/api/v1/topics/{topicId}/messages/{sequenceNumber}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"messages": [
{
"chunk_info": {
"initial_transaction_id": "0.0.10-1234567890-000000321",
"nonce": 3,
"number": 1,
"total": 2,
"scheduled": true
},
"consensus_timestamp": "1234567890.000000001",
"message": "bWVzc2FnZQ==",
"payer_account_id": "0.0.10",
"running_hash": "cnVubmluZ19oYXNo",
"running_hash_version": 2,
"sequence_number": 1,
"topic_id": "0.0.7"
}
],
"links": {
"next": "/api/v1/transactions?timestamp=lt:1657598275.517984411"
}
}{
"_status": {
"messages": [
{
"message": "Invalid parameter: account.id"
},
{
"message": "Invalid Transaction id. Please use \\shard.realm.num-sss-nnn\\ format where sss are seconds and nnn are nanoseconds"
}
]
}
}{
"_status": {
"messages": [
{
"message": "Not found"
}
]
}
}Get a topic’s message information by ID and sequence number.
This method will use
20 Compute Units.
Path Parameters
Topic id
Network entity ID in the format of shard.realm.num
Pattern:
^\d{1,10}\.\d{1,10}\.\d{1,10}$Example:
"0.1.2"
Topic message sequence number
Required range:
x >= 0Get topic message by id and sequence number
curl --request GET \
--url https://{network}.hedera.validationcloud.io/v1/{API_KEY}/api/v1/topics/{topicId}/messages/{sequenceNumber}import requests
url = "https://{network}.hedera.validationcloud.io/v1/{API_KEY}/api/v1/topics/{topicId}/messages/{sequenceNumber}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://{network}.hedera.validationcloud.io/v1/{API_KEY}/api/v1/topics/{topicId}/messages/{sequenceNumber}', 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://{network}.hedera.validationcloud.io/v1/{API_KEY}/api/v1/topics/{topicId}/messages/{sequenceNumber}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{network}.hedera.validationcloud.io/v1/{API_KEY}/api/v1/topics/{topicId}/messages/{sequenceNumber}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{network}.hedera.validationcloud.io/v1/{API_KEY}/api/v1/topics/{topicId}/messages/{sequenceNumber}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{network}.hedera.validationcloud.io/v1/{API_KEY}/api/v1/topics/{topicId}/messages/{sequenceNumber}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"messages": [
{
"chunk_info": {
"initial_transaction_id": "0.0.10-1234567890-000000321",
"nonce": 3,
"number": 1,
"total": 2,
"scheduled": true
},
"consensus_timestamp": "1234567890.000000001",
"message": "bWVzc2FnZQ==",
"payer_account_id": "0.0.10",
"running_hash": "cnVubmluZ19oYXNo",
"running_hash_version": 2,
"sequence_number": 1,
"topic_id": "0.0.7"
}
],
"links": {
"next": "/api/v1/transactions?timestamp=lt:1657598275.517984411"
}
}{
"_status": {
"messages": [
{
"message": "Invalid parameter: account.id"
},
{
"message": "Invalid Transaction id. Please use \\shard.realm.num-sss-nnn\\ format where sss are seconds and nnn are nanoseconds"
}
]
}
}{
"_status": {
"messages": [
{
"message": "Not found"
}
]
}
}