Stac Asset Sizes
const url = 'https://example.com/services/stac/asset-sizes';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"url":"example","assets":[{"id":"example","href":"example"}],"auth":{"method":"bearer","token":"example","username":"example","password":"example","header_name":"example","header_value":"example"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/services/stac/asset-sizes \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "url": "example", "assets": [ { "id": "example", "href": "example" } ], "auth": { "method": "bearer", "token": "example", "username": "example", "password": "example", "header_name": "example", "header_value": "example" } }'Look up the size of data assets whose item publishes no file:size.
Asks each asset’s server for its length (HEAD, then a one-byte range request). A size the server does not report comes back as null.
Authorizations
Section titled “ Authorizations ”Request Body required
Section titled “ Request Body required ”object
STAC API root URL the assets were found in.
Assets to measure (max 50 per request).
object
STAC item ID the asset belongs to.
URL of the item’s data asset.
How one request authenticates to the remote service it names.
object
How the credential is presented to the remote service. Omit the whole auth object for a public service.
Responses
Section titled “ Responses ”Successful Response
Bad request — invalid payload
Unauthorized — missing or invalid credentials
Forbidden — caller lacks write access
Not found
Conflict — resource state prevents the operation
Validation error
Too many requests — retry after the advertised interval
Headers
Section titled “ Headers ”Seconds until the request may be retried
Internal server error
Service unavailable — the database could not serve the request
Gateway timeout — an upstream address check ran out of time