GET /v0/block_id/by_time
stable
Get the block ID produced at a given time.
Usage
The following example fetches the block ID, time and block number for the timestamp 2019-03-04T10:36:14.6Z
.
curl -H "Authorization: Bearer eyJhbGciOiJLTVNFUzI1Ni..." \
"https://eos.dfuse.eosnation.io/v0/block_id/by_time?time=2019-03-04T10:36:14.5Z&comparator=gte"
fetch('https://eos.dfuse.eosnation.io/v0/block_id/by_time?time=2019-03-04T10:36:14.5Z&comparator=gte', {
headers: {
'Authorization': 'Bearer eyJhbGciOiJLTVNFUzI1Ni...'
}
}).then(console.log)
headers = { 'Authorization' : 'Bearer eyJhbGciOiJLTVNFUzI1Ni...' }
r = requests.get('https://eos.dfuse.eosnation.io/v0/block_id/by_time?time=2019-03-04T10:36:14.5Z&comparator=gte', headers=headers, verify=False)
j = json.loads(r.text)
print(json.dumps(j, indent=4))
req, err := http.NewRequest("GET", "https://eos.dfuse.eosnation.io/v0/block_id/by_time?time=2019-03-04T10:36:14.5Z&comparator=gte", nil)
if err != nil {
// handle err
}
req.Header.Set("Authorization", "Bearer eyJhbGciOiJLTVNFUzI1Ni...")
resp, err := http.DefaultClient.Do(req)
if err != nil {
// handle err
}
defer resp.Body.Close()
{
"block": {
"id": "02bb43ae0d74a228f021f598b552ffb1f8d2de2c29a8ea16a897d643e1d62d62",
"num": 45826990,
"time": "2019-03-04T10:36:15Z"
}
}
Input parameters
time
required
DateTime
Reference timestamp (ISO8601 extended format, ex:
2019-03-04T10:36:14.5Z
)
comparator
required
String
Comparison operator for the block time. Should be one of
gt
, gte
, lt
, lte
or eq
.
Response
Returns a block
JSON object, containing the following fields.
id
Optional
Number (uint32)
Block ID
num
Optional
Number
Block Number
time
Optional
DateTime
Timestamp of the matching block (according to its production schedule, so always aligned with 500ms time slots)