Get a listing's usage
curl --request GET \
--url https://testnet.rail402.dev/discovery/resources/{id}/usageimport requests
url = "https://testnet.rail402.dev/discovery/resources/{id}/usage"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://testnet.rail402.dev/discovery/resources/{id}/usage', 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://testnet.rail402.dev/discovery/resources/{id}/usage",
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://testnet.rail402.dev/discovery/resources/{id}/usage"
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://testnet.rail402.dev/discovery/resources/{id}/usage")
.asString();require 'uri'
require 'net/http'
url = URI("https://testnet.rail402.dev/discovery/resources/{id}/usage")
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{
"listingId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"payments": 123,
"payers": 123,
"firstObservedAt": "2023-11-07T05:31:56Z",
"lastObservedAt": "2023-11-07T05:31:56Z",
"recent": [
{
"transaction": "<string>",
"payer": "<string>",
"asset": "<string>",
"amount": "<string>",
"observedAt": "2023-11-07T05:31:56Z"
}
]
}{
"error": {
"code": "discovery_invalid_parameter",
"reason": "Unsupported parameter: foo.",
"retryable": false
}
}{
"error": {
"code": "discovery_usage_private",
"reason": "The seller of this listing keeps its usage private.",
"retryable": false
}
}{
"error": {
"code": "<string>",
"reason": "<string>",
"retryable": true,
"details": {}
}
}{
"error": {
"code": "discovery_overloaded",
"reason": "Discovery is at capacity; retry after the Retry-After interval.",
"retryable": true
}
}Discovery
Get a listing's usage
How a published listing was paid for on network: the settlements observed against it that paid
its current owner, the distinct payers, and the latest 20 settlements, newest first (none on a
network that publishes usage counts only, pubnet’s default). A listing that
is pending, quarantined or on another network is not found. A listing that declares the
rail402-private-usage extension, or whose content no origin confirmed (trust settled, such as an
mcp:// tool), answers 404 with the code discovery_usage_private.
GET
/
discovery
/
resources
/
{id}
/
usage
Get a listing's usage
curl --request GET \
--url https://testnet.rail402.dev/discovery/resources/{id}/usageimport requests
url = "https://testnet.rail402.dev/discovery/resources/{id}/usage"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://testnet.rail402.dev/discovery/resources/{id}/usage', 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://testnet.rail402.dev/discovery/resources/{id}/usage",
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://testnet.rail402.dev/discovery/resources/{id}/usage"
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://testnet.rail402.dev/discovery/resources/{id}/usage")
.asString();require 'uri'
require 'net/http'
url = URI("https://testnet.rail402.dev/discovery/resources/{id}/usage")
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{
"listingId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"payments": 123,
"payers": 123,
"firstObservedAt": "2023-11-07T05:31:56Z",
"lastObservedAt": "2023-11-07T05:31:56Z",
"recent": [
{
"transaction": "<string>",
"payer": "<string>",
"asset": "<string>",
"amount": "<string>",
"observedAt": "2023-11-07T05:31:56Z"
}
]
}{
"error": {
"code": "discovery_invalid_parameter",
"reason": "Unsupported parameter: foo.",
"retryable": false
}
}{
"error": {
"code": "discovery_usage_private",
"reason": "The seller of this listing keeps its usage private.",
"retryable": false
}
}{
"error": {
"code": "<string>",
"reason": "<string>",
"retryable": true,
"details": {}
}
}{
"error": {
"code": "discovery_overloaded",
"reason": "Discovery is at capacity; retry after the Retry-After interval.",
"retryable": true
}
}Path Parameters
A listing's id (rail402.listings[].id).
Query Parameters
The network whose listings and settlements are read.
Available options:
stellar:testnet, stellar:pubnet Response
The listing's usage.