Series cache service#
The Series Cache service manages internal chunks of data cached by Nominal’s backend.
OpenAPI file: SeriesCacheService.json
Endpoints#
Get chunks#
POST /timeseries/series-cache/v1/logical-series/{logicalSeriesRid}/get-chunks
Fetches “chunks” of series that are stored as Arrow files in S3. This endpoint is being deprecated for new series in favor of batchGetCachedSeries
Path parameters
logicalSeriesRidstring (RID) required
Body
startTimestampTimestamprequired
Fields of
Timestampsecondsinteger (int64) required
nanosinteger (int64) required
endTimestampTimestamprequired
resolutionNanosinteger (int64) required
Response
chunksarray ofChunk
Fields of
Chunkridstring (RID)
typeChunkType
Values of
ChunkTypeARROW_WITH_RELATIVE_TIMESTAMPS
ARROW_WITH_ABSOLUTE_TIMESTAMPS
logicalSeriesRidstring (RID)
startTimestampTimestamp
Fields of
Timestampsecondsinteger (int64)
nanosinteger (int64)
endTimestampTimestamp
countinteger (int64)The number of distinct timestamps contained within the chunk.
sizeInBytesinteger (int64)
resolutioninteger (int64)
handleHandle
Set
typeto"s3".s3S3Handle
Fields of
S3Handles3Pathstring
Request
curl -X POST "https://api.gov.nominal.io/api/timeseries/series-cache/v1/logical-series/<logical series rid>/get-chunks" \
-H "Authorization: Bearer <api key>" \
-H "Content-Type: application/json" \
--data '{
"startTimestamp": {
"seconds": 1,
"nanos": 1
},
"endTimestamp": {
"seconds": 1,
"nanos": 1
},
"resolutionNanos": 1
}'
import requests
response = requests.post(
"https://api.gov.nominal.io/api/timeseries/series-cache/v1/logical-series/<logical series rid>/get-chunks",
headers={"Authorization": "Bearer <api key>"},
json={
"startTimestamp": {"seconds": 1, "nanos": 1},
"endTimestamp": {"seconds": 1, "nanos": 1},
"resolutionNanos": 1,
},
)
response.raise_for_status()
print(response.json())
import httpx
response = httpx.post(
"https://api.gov.nominal.io/api/timeseries/series-cache/v1/logical-series/<logical series rid>/get-chunks",
headers={"Authorization": "Bearer <api key>"},
json={
"startTimestamp": {"seconds": 1, "nanos": 1},
"endTimestamp": {"seconds": 1, "nanos": 1},
"resolutionNanos": 1,
},
)
response.raise_for_status()
print(response.json())
import asyncio
import aiohttp
async def main() -> None:
async with aiohttp.ClientSession() as session:
async with session.post(
"https://api.gov.nominal.io/api/timeseries/series-cache/v1/logical-series/<logical series rid>/get-chunks",
headers={"Authorization": "Bearer <api key>"},
json={
"startTimestamp": {"seconds": 1, "nanos": 1},
"endTimestamp": {"seconds": 1, "nanos": 1},
"resolutionNanos": 1,
},
) as response:
response.raise_for_status()
print(await response.json())
asyncio.run(main())
Response: 200
{
"chunks": [
{
"rid": "<chunk rid>",
"type": "ARROW_WITH_RELATIVE_TIMESTAMPS",
"logicalSeriesRid": "<logical series rid>",
"startTimestamp": {
"seconds": 1,
"nanos": 1
},
"endTimestamp": {
"seconds": 1,
"nanos": 1
},
"count": 1,
"sizeInBytes": 1,
"resolution": 1,
"handle": {
"type": "s3",
"s3": {
"s3Path": "<s3 path>"
}
}
}
]
}
Create chunks#
POST /timeseries/series-cache/v1/logical-series/{logicalSeriesRid}/create-chunks
Deprecated: Deprecated in favor of batchCreateChunks
Path parameters
logicalSeriesRidstring (RID) required
Body
createChunksarray ofCreateChunk
Fields of
CreateChunktypeChunkTyperequired
Values of
ChunkTypeARROW_WITH_RELATIVE_TIMESTAMPS
ARROW_WITH_ABSOLUTE_TIMESTAMPS
logicalSeriesRidstring (RID) required
startTimestampTimestamprequired
Fields of
Timestampsecondsinteger (int64) required
nanosinteger (int64) required
endTimestampTimestamprequired
countinteger (int64) required
sizeInBytesinteger (int64) required
resolutioninteger (int64) required
handleHandlerequired
Set
typeto"s3".s3S3Handle
Fields of
S3Handles3Pathstring required
Response
chunkRidsarray of string (RID)
Request
curl -X POST "https://api.gov.nominal.io/api/timeseries/series-cache/v1/logical-series/<logical series rid>/create-chunks" \
-H "Authorization: Bearer <api key>" \
-H "Content-Type: application/json" \
--data '{
"createChunks": [
{
"type": "ARROW_WITH_RELATIVE_TIMESTAMPS",
"logicalSeriesRid": "<logical series rid>",
"startTimestamp": {
"seconds": 1,
"nanos": 1
},
"endTimestamp": {
"seconds": 1,
"nanos": 1
},
"count": 1,
"sizeInBytes": 1,
"resolution": 1,
"handle": {
"type": "s3",
"s3": {
"s3Path": "<s3 path>"
}
}
}
]
}'
import requests
response = requests.post(
"https://api.gov.nominal.io/api/timeseries/series-cache/v1/logical-series/<logical series rid>/create-chunks",
headers={"Authorization": "Bearer <api key>"},
json={
"createChunks": [
{
"type": "ARROW_WITH_RELATIVE_TIMESTAMPS",
"logicalSeriesRid": "<logical series rid>",
"startTimestamp": {"seconds": 1, "nanos": 1},
"endTimestamp": {"seconds": 1, "nanos": 1},
"count": 1,
"sizeInBytes": 1,
"resolution": 1,
"handle": {"type": "s3", "s3": {"s3Path": "<s3 path>"}},
},
],
},
)
response.raise_for_status()
print(response.json())
import httpx
response = httpx.post(
"https://api.gov.nominal.io/api/timeseries/series-cache/v1/logical-series/<logical series rid>/create-chunks",
headers={"Authorization": "Bearer <api key>"},
json={
"createChunks": [
{
"type": "ARROW_WITH_RELATIVE_TIMESTAMPS",
"logicalSeriesRid": "<logical series rid>",
"startTimestamp": {"seconds": 1, "nanos": 1},
"endTimestamp": {"seconds": 1, "nanos": 1},
"count": 1,
"sizeInBytes": 1,
"resolution": 1,
"handle": {"type": "s3", "s3": {"s3Path": "<s3 path>"}},
},
],
},
)
response.raise_for_status()
print(response.json())
import asyncio
import aiohttp
async def main() -> None:
async with aiohttp.ClientSession() as session:
async with session.post(
"https://api.gov.nominal.io/api/timeseries/series-cache/v1/logical-series/<logical series rid>/create-chunks",
headers={"Authorization": "Bearer <api key>"},
json={
"createChunks": [
{
"type": "ARROW_WITH_RELATIVE_TIMESTAMPS",
"logicalSeriesRid": "<logical series rid>",
"startTimestamp": {"seconds": 1, "nanos": 1},
"endTimestamp": {"seconds": 1, "nanos": 1},
"count": 1,
"sizeInBytes": 1,
"resolution": 1,
"handle": {"type": "s3", "s3": {"s3Path": "<s3 path>"}},
},
],
},
) as response:
response.raise_for_status()
print(await response.json())
asyncio.run(main())
Response: 200
{
"chunkRids": [
"<chunk rid>"
]
}
Batch create chunks#
POST /timeseries/series-cache/v1/batch-create-chunks
Body
createChunksarray ofCreateChunk
Fields of
CreateChunktypeChunkTyperequired
Values of
ChunkTypeARROW_WITH_RELATIVE_TIMESTAMPS
ARROW_WITH_ABSOLUTE_TIMESTAMPS
logicalSeriesRidstring (RID) required
startTimestampTimestamprequired
Fields of
Timestampsecondsinteger (int64) required
nanosinteger (int64) required
endTimestampTimestamprequired
countinteger (int64) required
sizeInBytesinteger (int64) required
resolutioninteger (int64) required
handleHandlerequired
Set
typeto"s3".s3S3Handle
Fields of
S3Handles3Pathstring required
Response
chunkRidsarray of string (RID)
Request
curl -X POST "https://api.gov.nominal.io/api/timeseries/series-cache/v1/batch-create-chunks" \
-H "Authorization: Bearer <api key>" \
-H "Content-Type: application/json" \
--data '{
"createChunks": [
{
"type": "ARROW_WITH_RELATIVE_TIMESTAMPS",
"logicalSeriesRid": "<logical series rid>",
"startTimestamp": {
"seconds": 1,
"nanos": 1
},
"endTimestamp": {
"seconds": 1,
"nanos": 1
},
"count": 1,
"sizeInBytes": 1,
"resolution": 1,
"handle": {
"type": "s3",
"s3": {
"s3Path": "<s3 path>"
}
}
}
]
}'
import requests
response = requests.post(
"https://api.gov.nominal.io/api/timeseries/series-cache/v1/batch-create-chunks",
headers={"Authorization": "Bearer <api key>"},
json={
"createChunks": [
{
"type": "ARROW_WITH_RELATIVE_TIMESTAMPS",
"logicalSeriesRid": "<logical series rid>",
"startTimestamp": {"seconds": 1, "nanos": 1},
"endTimestamp": {"seconds": 1, "nanos": 1},
"count": 1,
"sizeInBytes": 1,
"resolution": 1,
"handle": {"type": "s3", "s3": {"s3Path": "<s3 path>"}},
},
],
},
)
response.raise_for_status()
print(response.json())
import httpx
response = httpx.post(
"https://api.gov.nominal.io/api/timeseries/series-cache/v1/batch-create-chunks",
headers={"Authorization": "Bearer <api key>"},
json={
"createChunks": [
{
"type": "ARROW_WITH_RELATIVE_TIMESTAMPS",
"logicalSeriesRid": "<logical series rid>",
"startTimestamp": {"seconds": 1, "nanos": 1},
"endTimestamp": {"seconds": 1, "nanos": 1},
"count": 1,
"sizeInBytes": 1,
"resolution": 1,
"handle": {"type": "s3", "s3": {"s3Path": "<s3 path>"}},
},
],
},
)
response.raise_for_status()
print(response.json())
import asyncio
import aiohttp
async def main() -> None:
async with aiohttp.ClientSession() as session:
async with session.post(
"https://api.gov.nominal.io/api/timeseries/series-cache/v1/batch-create-chunks",
headers={"Authorization": "Bearer <api key>"},
json={
"createChunks": [
{
"type": "ARROW_WITH_RELATIVE_TIMESTAMPS",
"logicalSeriesRid": "<logical series rid>",
"startTimestamp": {"seconds": 1, "nanos": 1},
"endTimestamp": {"seconds": 1, "nanos": 1},
"count": 1,
"sizeInBytes": 1,
"resolution": 1,
"handle": {"type": "s3", "s3": {"s3Path": "<s3 path>"}},
},
],
},
) as response:
response.raise_for_status()
print(await response.json())
asyncio.run(main())
Response: 200
{
"chunkRids": [
"<chunk rid>"
]
}
Delete chunks#
POST /timeseries/series-cache/v1/logical-series/{logicalSeriesRid}/delete-chunks
Deletes the chunks that intersect the given time range. Does not delete the corresponding files from S3.
Path parameters
logicalSeriesRidstring (RID) required
Body
startTimestampTimestamprequired
Fields of
Timestampsecondsinteger (int64) required
nanosinteger (int64) required
endTimestampTimestamprequired
Response
deletedChunkRidsarray of string (RID)
Request
curl -X POST "https://api.gov.nominal.io/api/timeseries/series-cache/v1/logical-series/<logical series rid>/delete-chunks" \
-H "Authorization: Bearer <api key>" \
-H "Content-Type: application/json" \
--data '{
"startTimestamp": {
"seconds": 1,
"nanos": 1
},
"endTimestamp": {
"seconds": 1,
"nanos": 1
}
}'
import requests
response = requests.post(
"https://api.gov.nominal.io/api/timeseries/series-cache/v1/logical-series/<logical series rid>/delete-chunks",
headers={"Authorization": "Bearer <api key>"},
json={
"startTimestamp": {"seconds": 1, "nanos": 1},
"endTimestamp": {"seconds": 1, "nanos": 1},
},
)
response.raise_for_status()
print(response.json())
import httpx
response = httpx.post(
"https://api.gov.nominal.io/api/timeseries/series-cache/v1/logical-series/<logical series rid>/delete-chunks",
headers={"Authorization": "Bearer <api key>"},
json={
"startTimestamp": {"seconds": 1, "nanos": 1},
"endTimestamp": {"seconds": 1, "nanos": 1},
},
)
response.raise_for_status()
print(response.json())
import asyncio
import aiohttp
async def main() -> None:
async with aiohttp.ClientSession() as session:
async with session.post(
"https://api.gov.nominal.io/api/timeseries/series-cache/v1/logical-series/<logical series rid>/delete-chunks",
headers={"Authorization": "Bearer <api key>"},
json={
"startTimestamp": {"seconds": 1, "nanos": 1},
"endTimestamp": {"seconds": 1, "nanos": 1},
},
) as response:
response.raise_for_status()
print(await response.json())
asyncio.run(main())
Response: 200
{
"deletedChunkRids": [
"<chunk rid>"
]
}
Errors#
Errors shows how these errors are sent.
Each error’s errorName is SeriesCache: followed by its name below.
Status |
Name |
Notes |
|---|---|---|
409 |
|
Types#
Chunk#
ridstring (RID) required
typeChunkTyperequired
logicalSeriesRidstring (RID) required
startTimestampTimestamprequired
endTimestampTimestamprequired
countinteger (int64) requiredThe number of distinct timestamps contained within the chunk.
sizeInBytesinteger (int64) required
resolutioninteger (int64) required
handleHandlerequired
ChunkType#
ARROW_WITH_RELATIVE_TIMESTAMPS
ARROW_WITH_ABSOLUTE_TIMESTAMPS
CreateChunk#
Handle#
Set type to the name of one of the other fields, and set only that field.
s3S3Handle
S3Handle#
s3Pathstring required
Timestamp#
Deprecated for new APIs. Use google.protobuf.Timestamp for absolute instants in proto APIs.
This legacy nanosecond precision timestamp type is represented by an epoch time in seconds and a nanosecond offset. The nanosecond offset is from the start of the epoch second, so must be less than 1 billion.
secondsinteger (int64) required
nanosinteger (int64) required
Page design based on Scalar, MIT License.