Blob storage service#
Service for storing and retrieving blobs in object storage with workspace-based authorization.
OpenAPI file: nominal.blob_storage_service.v1.json
Endpoints#
Upload blob stream#
POST /blobs/v1
Upload a blob using streaming. The blob will be stored with authorization checks based on the provided owningRid.
Body
owningRidResourceIdentifierrequired
Fields of
ResourceIdentifierridstring requiredMatches
^ri\.[a-z][a-z0-9\-]*\.([a-z0-9][a-z0-9\-]*)?\.[a-z][a-z0-9\-]*\.[a-zA-Z0-9\-\._]+$.
fileNamestring required
ensureUniqueboolean requiredwhen set to true, ensure_unique will attach the current timestamp to the file name this will ensure that we do not overwrite an existing file in blob storage
contentstring (base64) required
Response
fileNamestringThis is the key that can be used in a retrieve blob request in order to retrieve this specific blob. If ensure_unique is not set, this will match the file name provided in UploadBlobStreamRequest
Request
curl -X POST "https://api.gov.nominal.io/api/blobs/v1" \
-H "Authorization: Bearer <api key>" \
-H "Content-Type: application/json" \
--data '{
"owningRid": {
"rid": "<rid>"
},
"fileName": "<file name>",
"ensureUnique": true,
"content": "<content>"
}'
import requests
response = requests.post(
"https://api.gov.nominal.io/api/blobs/v1",
headers={"Authorization": "Bearer <api key>"},
json={
"owningRid": {"rid": "<rid>"},
"fileName": "<file name>",
"ensureUnique": True,
"content": "<content>",
},
)
response.raise_for_status()
print(response.json())
import httpx
response = httpx.post(
"https://api.gov.nominal.io/api/blobs/v1",
headers={"Authorization": "Bearer <api key>"},
json={
"owningRid": {"rid": "<rid>"},
"fileName": "<file name>",
"ensureUnique": True,
"content": "<content>",
},
)
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/blobs/v1",
headers={"Authorization": "Bearer <api key>"},
json={
"owningRid": {"rid": "<rid>"},
"fileName": "<file name>",
"ensureUnique": True,
"content": "<content>",
},
) as response:
response.raise_for_status()
print(await response.json())
asyncio.run(main())
Response: 200
{
"fileName": "<file name>"
}
Get signed URL for blob#
POST /blobs/v1/get
Retrieve a signed URL for downloading a blob. The URL is valid for 15 minutes.
Body
owningRidResourceIdentifierrequired
Fields of
ResourceIdentifierridstring requiredMatches
^ri\.[a-z][a-z0-9\-]*\.([a-z0-9][a-z0-9\-]*)?\.[a-z][a-z0-9\-]*\.[a-zA-Z0-9\-\._]+$.
fileNamestring required
Response
urlstringThis is a short lived signed url that can be used by the client to retrieve the object
Request
curl -X POST "https://api.gov.nominal.io/api/blobs/v1/get" \
-H "Authorization: Bearer <api key>" \
-H "Content-Type: application/json" \
--data '{
"owningRid": {
"rid": "<rid>"
},
"fileName": "<file name>"
}'
import requests
response = requests.post(
"https://api.gov.nominal.io/api/blobs/v1/get",
headers={"Authorization": "Bearer <api key>"},
json={"owningRid": {"rid": "<rid>"}, "fileName": "<file name>"},
)
response.raise_for_status()
print(response.json())
import httpx
response = httpx.post(
"https://api.gov.nominal.io/api/blobs/v1/get",
headers={"Authorization": "Bearer <api key>"},
json={"owningRid": {"rid": "<rid>"}, "fileName": "<file name>"},
)
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/blobs/v1/get",
headers={"Authorization": "Bearer <api key>"},
json={"owningRid": {"rid": "<rid>"}, "fileName": "<file name>"},
) as response:
response.raise_for_status()
print(await response.json())
asyncio.run(main())
Response: 200
{
"url": "<url>"
}
Types#
ResourceIdentifier#
This is used to identify any type of blob that will be in object storage.
ridstring requiredMatches
^ri\.[a-z][a-z0-9\-]*\.([a-z0-9][a-z0-9\-]*)?\.[a-z][a-z0-9\-]*\.[a-zA-Z0-9\-\._]+$.
Page design based on Scalar, MIT License.