Ir al contenido
v2.7

Sites

Sitios estáticos y SSR: crear, publicar por subida, despliegues, logs de peticiones y variables.

Sitios estáticos y SSR: crear, publicar por subida, despliegues, logs de peticiones y variables.

Clase Sites: 23 métodos (0 en @owbase/web, 23 en @owbase/node). Las descripciones de los métodos están en inglés. Los ejemplos usan la forma de objeto de los parámetros; cambia los valores entre < y > por los tuyos.

Listar sitios

GET /sites · página del método

SDK: solo @owbase/node

Get a list of all the project’s sites. You can use the query params to filter your results.

Parámetro Tipo Obligatorio Descripción
queries string[] no Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, framework, deploymentId, buildCommand, installCommand, outputDirectory, installationId
search string no Search term to filter your list results. Max length: 256 chars.
total boolean no When set to false, the total count returned will be 0 and will not be calculated.

Acceso: clave de API con el alcance sites.read.

@owbase/node
import { Client, Sites } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const sites = new Sites(client);
const result = await sites.list({
queries: [], // optional
search: '<SEARCH>', // optional
total: false, // optional
});

Crear sitio

POST /sites · página del método

SDK: solo @owbase/node

Create a new site.

El despliegue es solo por subida: los parámetros de repositorio Git quedan fuera (consulta Publicar).

Parámetro Tipo Obligatorio Descripción
siteId string sí Site ID. Choose a custom ID or generate a random ID with ID.unique(). Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can’t start with a special char. Max length is 36 chars.
name string sí Site name. Max length: 128 chars.
framework Framework sí Sites framework. Valores: analog, angular, nextjs, react, nuxt, vue, sveltekit, astro, tanstack-start, remix, lynx, react-native, vite, other (solo los frameworks de Node en Owbase).
buildRuntime BuildRuntime sí Runtime to use during build step. Valores: node-22 (solo Node 22 en Owbase).
enabled boolean no Is site enabled? When set to ‘disabled’, users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled.
logging boolean no When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.
timeout number no Maximum request time in seconds.
installCommand string no Install Command.
buildCommand string no Build Command.
startCommand string no Custom start command. Leave empty to use default.
outputDirectory string no Output Directory for site.
adapter Adapter no Framework adapter defining rendering strategy. Allowed values are: static, ssr Valores: static, ssr.
fallbackFile string no Fallback file for single page application sites.
buildSpecification string no Build specification for the site deployments.
runtimeSpecification string no Runtime specification for the SSR executions.
deploymentRetention number no Days to keep non-active deployments before deletion. Value 0 keeps all deployments unless the server applies a default retention. New sites default to 30 days.
scopes ProjectKeyScopes[] no List of scopes allowed for API key auto-generated for every site build and SSR execution. Maximum of 200 scopes are allowed. Valores: project.read, project.write, usage.read, keys.read, keys.write, platforms.read, platforms.write, mocks.read, mocks.write, policies.read, policies.write, project.policies.read, project.policies.write, project.oauth2.read, project.oauth2.write, templates.read, templates.write, stages.read, stages.write, users.read, users.write, sessions.read, sessions.write, teams.read, teams.write, databases.read, databases.write, tables.read, tables.write, columns.read, columns.write, indexes.read, indexes.write, rows.read, rows.write, embeddings.write, collections.read, collections.write, attributes.read, attributes.write, documents.read, documents.write, documentsdb.read, documentsdb.write, documentsdb.collections.read, documentsdb.collections.write, documentsdb.documents.read, documentsdb.documents.write, documentsdb.indexes.read, documentsdb.indexes.write, vectorsdb.read, vectorsdb.write, vectorsdb.collections.read, vectorsdb.collections.write, vectorsdb.documents.read, vectorsdb.documents.write, vectorsdb.indexes.read, vectorsdb.indexes.write, buckets.read, buckets.write, files.read, files.write, tokens.read, tokens.write, functions.read, functions.write, executions.read, executions.write, execution.read, execution.write, sites.read, sites.write, log.read, log.write, providers.read, providers.write, topics.read, topics.write, subscribers.read, subscribers.write, targets.read, targets.write, messages.read, messages.write, rules.read, rules.write, webhooks.read, webhooks.write, monitors.read, monitors.write, alerts.read, locale.read, avatars.read, avatars.write, health.read, assistant.read, migrations.read, migrations.write, schedules.read, schedules.write, vcs.read, vcs.write, insights.read, insights.write, reports.read, reports.write, reviews.read, reviews.write, presences.read, presences.write.
description string no Optional description for the site.

Acceso: clave de API con el alcance sites.write.

@owbase/node
import { Client, Sites, Framework, BuildRuntime, Adapter, ProjectKeyScopes } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const sites = new Sites(client);
const result = await sites.create({
siteId: '<SITE_ID>',
name: '<NAME>',
framework: Framework.Nextjs,
buildRuntime: BuildRuntime.Node22,
enabled: false, // optional
logging: false, // optional
timeout: 1, // optional
installCommand: '<INSTALL_COMMAND>', // optional
buildCommand: '<BUILD_COMMAND>', // optional
startCommand: '<START_COMMAND>', // optional
outputDirectory: '<OUTPUT_DIRECTORY>', // optional
adapter: Adapter.Static, // optional
fallbackFile: '<FALLBACK_FILE>', // optional
buildSpecification: 's-1vcpu-512mb', // optional
runtimeSpecification: 's-1vcpu-512mb', // optional
deploymentRetention: 0, // optional
scopes: [ProjectKeyScopes.ProjectRead], // optional
description: '<DESCRIPTION>', // optional
});

Listar frameworks

GET /sites/frameworks · página del método

SDK: solo @owbase/node

Get a list of all frameworks that are currently available on the server instance.

Parámetro Tipo Obligatorio Descripción
total boolean no When set to false, the total count returned will be 0 and will not be calculated.

Acceso: clave de API sin alcance específico.

@owbase/node
import { Client, Sites } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const sites = new Sites(client);
const result = await sites.listFrameworks({
total: false, // optional
});

Listar especificaciones

GET /sites/specifications · página del método

SDK: solo @owbase/node

List allowed site specifications for this instance.

Parámetro Tipo Obligatorio Descripción
type string no Specification type to list. Can be one of: runtimes, builds. Defaults to runtimes.
total boolean no When set to false, the total count returned will be 0 and will not be calculated.

Acceso: clave de API con el alcance sites.read.

@owbase/node
import { Client, Sites } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const sites = new Sites(client);
const result = await sites.listSpecifications({
type: 'runtimes', // optional
total: false, // optional
});

Obtener sitio

GET /sites/{siteId} · página del método

SDK: solo @owbase/node

Get a site by its unique ID.

Parámetro Tipo Obligatorio Descripción
siteId string sí Site ID.

Acceso: clave de API con el alcance sites.read.

@owbase/node
import { Client, Sites } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const sites = new Sites(client);
const result = await sites.get({
siteId: '<SITE_ID>',
});

Actualizar sitio

PUT /sites/{siteId} · página del método

SDK: solo @owbase/node

Update site by its unique ID.

El despliegue es solo por subida: los parámetros de repositorio Git quedan fuera (consulta Publicar).

Parámetro Tipo Obligatorio Descripción
siteId string sí Site ID.
name string sí Site name. Max length: 128 chars.
framework Framework sí Sites framework. Valores: analog, angular, nextjs, react, nuxt, vue, sveltekit, astro, tanstack-start, remix, lynx, react-native, vite, other (solo los frameworks de Node en Owbase).
enabled boolean no Is site enabled? When set to ‘disabled’, users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled.
logging boolean no When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.
timeout number no Maximum request time in seconds.
installCommand string no Install Command.
buildCommand string no Build Command.
startCommand string no Custom start command. Leave empty to use default.
outputDirectory string no Output Directory for site.
buildRuntime BuildRuntime no Runtime to use during build step. Valores: node-22 (solo Node 22 en Owbase).
adapter Adapter no Framework adapter defining rendering strategy. Allowed values are: static, ssr Valores: static, ssr.
fallbackFile string no Fallback file for single page application sites.
buildSpecification string no Build specification for the site deployments.
runtimeSpecification string no Runtime specification for the SSR executions.
deploymentRetention number no Days to keep non-active deployments before deletion. Value 0 keeps all deployments unless the server applies a default retention. Leave it out to keep the current value.
scopes ProjectKeyScopes[] no List of scopes allowed for API key auto-generated for every site build and SSR execution. Maximum of 200 scopes are allowed. Valores: project.read, project.write, usage.read, keys.read, keys.write, platforms.read, platforms.write, mocks.read, mocks.write, policies.read, policies.write, project.policies.read, project.policies.write, project.oauth2.read, project.oauth2.write, templates.read, templates.write, stages.read, stages.write, users.read, users.write, sessions.read, sessions.write, teams.read, teams.write, databases.read, databases.write, tables.read, tables.write, columns.read, columns.write, indexes.read, indexes.write, rows.read, rows.write, embeddings.write, collections.read, collections.write, attributes.read, attributes.write, documents.read, documents.write, documentsdb.read, documentsdb.write, documentsdb.collections.read, documentsdb.collections.write, documentsdb.documents.read, documentsdb.documents.write, documentsdb.indexes.read, documentsdb.indexes.write, vectorsdb.read, vectorsdb.write, vectorsdb.collections.read, vectorsdb.collections.write, vectorsdb.documents.read, vectorsdb.documents.write, vectorsdb.indexes.read, vectorsdb.indexes.write, buckets.read, buckets.write, files.read, files.write, tokens.read, tokens.write, functions.read, functions.write, executions.read, executions.write, execution.read, execution.write, sites.read, sites.write, log.read, log.write, providers.read, providers.write, topics.read, topics.write, subscribers.read, subscribers.write, targets.read, targets.write, messages.read, messages.write, rules.read, rules.write, webhooks.read, webhooks.write, monitors.read, monitors.write, alerts.read, locale.read, avatars.read, avatars.write, health.read, assistant.read, migrations.read, migrations.write, schedules.read, schedules.write, vcs.read, vcs.write, insights.read, insights.write, reports.read, reports.write, reviews.read, reviews.write, presences.read, presences.write.
description string no Optional description for the site.

Acceso: clave de API con el alcance sites.write.

@owbase/node
import { Client, Sites, Framework, BuildRuntime, Adapter, ProjectKeyScopes } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const sites = new Sites(client);
const result = await sites.update({
siteId: '<SITE_ID>',
name: '<NAME>',
framework: Framework.Nextjs,
enabled: false, // optional
logging: false, // optional
timeout: 1, // optional
installCommand: '<INSTALL_COMMAND>', // optional
buildCommand: '<BUILD_COMMAND>', // optional
startCommand: '<START_COMMAND>', // optional
outputDirectory: '<OUTPUT_DIRECTORY>', // optional
buildRuntime: BuildRuntime.Node22, // optional
adapter: Adapter.Static, // optional
fallbackFile: '<FALLBACK_FILE>', // optional
buildSpecification: 's-1vcpu-512mb', // optional
runtimeSpecification: 's-1vcpu-512mb', // optional
deploymentRetention: 0, // optional
scopes: [ProjectKeyScopes.ProjectRead], // optional
description: '<DESCRIPTION>', // optional
});

Eliminar sitio

DELETE /sites/{siteId} · página del método

SDK: solo @owbase/node

Delete a site by its unique ID.

Parámetro Tipo Obligatorio Descripción
siteId string sí Site ID.

Acceso: clave de API con el alcance sites.write.

@owbase/node
import { Client, Sites } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const sites = new Sites(client);
const result = await sites.delete({
siteId: '<SITE_ID>',
});

Actualizar despliegue del sitio

PATCH /sites/{siteId}/deployment · página del método

SDK: solo @owbase/node

Update the site active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your site.

Parámetro Tipo Obligatorio Descripción
siteId string sí Site ID.
deploymentId string sí Deployment ID.

Acceso: clave de API con el alcance sites.write.

@owbase/node
import { Client, Sites } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const sites = new Sites(client);
const result = await sites.updateSiteDeployment({
siteId: '<SITE_ID>',
deploymentId: '<DEPLOYMENT_ID>',
});

Listar despliegues

GET /sites/{siteId}/deployments · página del método

SDK: solo @owbase/node

Get a list of all the site’s code deployments. You can use the query params to filter your results.

Parámetro Tipo Obligatorio Descripción
siteId string sí Site ID.
queries string[] no Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: buildSize, sourceSize, totalSize, buildDuration, status, activate, type
search string no Search term to filter your list results. Max length: 256 chars.
total boolean no When set to false, the total count returned will be 0 and will not be calculated.

Acceso: clave de API con el alcance sites.read.

@owbase/node
import { Client, Sites } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const sites = new Sites(client);
const result = await sites.listDeployments({
siteId: '<SITE_ID>',
queries: [], // optional
search: '<SEARCH>', // optional
total: false, // optional
});

Crear despliegue

POST /sites/{siteId}/deployments · página del método

SDK: solo @owbase/node

Create a new site code deployment. Use this endpoint to upload a new version of your site code. To activate your newly uploaded code, you’ll need to update the site’s deployment to use your new deployment ID.

Parámetro Tipo Obligatorio Descripción
siteId string sí Site ID.
code File (en node, también InputFile) sí Gzip file with your code package. When used with the Owbase CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.
installCommand string no Install Commands.
buildCommand string no Build Commands.
outputDirectory string no Output Directory.
activate boolean no Automatically activate the deployment when it is finished building.
onProgress (progress: UploadProgress) => void no Callback called after each uploaded chunk with the upload progress ($id, progress in percent, sizeUploaded, chunksTotal, chunksUploaded).

Acceso: clave de API con el alcance sites.write.

@owbase/node
import { Client, Sites } from '@owbase/node';
import { InputFile } from '@owbase/node/file';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const sites = new Sites(client);
const result = await sites.createDeployment({
siteId: '<SITE_ID>',
code: InputFile.fromPath('/path/to/file', 'filename'),
installCommand: '<INSTALL_COMMAND>', // optional
buildCommand: '<BUILD_COMMAND>', // optional
outputDirectory: '<OUTPUT_DIRECTORY>', // optional
activate: false, // optional
});

Crear despliegue duplicado

POST /sites/{siteId}/deployments/duplicate · página del método

SDK: solo @owbase/node

Create a new build for an existing site deployment. This endpoint allows you to rebuild a deployment with the updated site configuration, including its commands and output directory if they have been modified. The build process will be queued and executed asynchronously. The original deployment’s code will be preserved and used for the new build.

Parámetro Tipo Obligatorio Descripción
siteId string sí Site ID.
deploymentId string sí Deployment ID.

Acceso: clave de API con el alcance sites.write.

@owbase/node
import { Client, Sites } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const sites = new Sites(client);
const result = await sites.createDuplicateDeployment({
siteId: '<SITE_ID>',
deploymentId: '<DEPLOYMENT_ID>',
});

Obtener despliegue

GET /sites/{siteId}/deployments/{deploymentId} · página del método

SDK: solo @owbase/node

Get a site deployment by its unique ID.

Parámetro Tipo Obligatorio Descripción
siteId string sí Site ID.
deploymentId string sí Deployment ID.

Acceso: clave de API con el alcance sites.read.

@owbase/node
import { Client, Sites } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const sites = new Sites(client);
const result = await sites.getDeployment({
siteId: '<SITE_ID>',
deploymentId: '<DEPLOYMENT_ID>',
});

Eliminar despliegue

DELETE /sites/{siteId}/deployments/{deploymentId} · página del método

SDK: solo @owbase/node

Delete a site deployment by its unique ID.

Parámetro Tipo Obligatorio Descripción
siteId string sí Site ID.
deploymentId string sí Deployment ID.

Acceso: clave de API con el alcance sites.write.

@owbase/node
import { Client, Sites } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const sites = new Sites(client);
const result = await sites.deleteDeployment({
siteId: '<SITE_ID>',
deploymentId: '<DEPLOYMENT_ID>',
});

Obtener descarga del despliegue

GET /sites/{siteId}/deployments/{deploymentId}/download · página del método

SDK: solo @owbase/node

Get a site deployment content by its unique ID. The endpoint response return with a ‘Content-Disposition: attachment’ header that tells the browser to start downloading the file to user downloads directory.

Parámetro Tipo Obligatorio Descripción
siteId string sí Site ID.
deploymentId string sí Deployment ID.
type DeploymentDownloadType no Deployment file to download. Can be: “source”, “output”. Valores: source, output.
token string no Presigned source-download token for accessing this deployment without a session (jobs-service).

Acceso: clave de API con el alcance sites.read o sesión del usuario (vale lo que permitan los permisos del recurso).

@owbase/node
import { Client, Sites, DeploymentDownloadType } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const sites = new Sites(client);
const result = await sites.getDeploymentDownload({
siteId: '<SITE_ID>',
deploymentId: '<DEPLOYMENT_ID>',
type: DeploymentDownloadType.Source, // optional
token: '<TOKEN>', // optional
});

Actualizar estado del despliegue

PATCH /sites/{siteId}/deployments/{deploymentId}/status · página del método

SDK: solo @owbase/node

Cancel an ongoing site deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn’t started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status ‘ready’) or failed. The response includes the final build status and details.

Parámetro Tipo Obligatorio Descripción
siteId string sí Site ID.
deploymentId string sí Deployment ID.

Acceso: clave de API con el alcance sites.write.

@owbase/node
import { Client, Sites } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const sites = new Sites(client);
const result = await sites.updateDeploymentStatus({
siteId: '<SITE_ID>',
deploymentId: '<DEPLOYMENT_ID>',
});

Listar logs

GET /sites/{siteId}/logs · página del método

SDK: solo @owbase/node

Get a list of all site logs. You can use the query params to filter your results.

Parámetro Tipo Obligatorio Descripción
siteId string sí Site ID.
queries string[] no Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId
total boolean no When set to false, the total count returned will be 0 and will not be calculated.

Acceso: clave de API con el alcance log.read.

@owbase/node
import { Client, Sites } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const sites = new Sites(client);
const result = await sites.listLogs({
siteId: '<SITE_ID>',
queries: [], // optional
total: false, // optional
});

Obtener log

GET /sites/{siteId}/logs/{logId} · página del método

SDK: solo @owbase/node

Get a site request log by its unique ID.

Parámetro Tipo Obligatorio Descripción
siteId string sí Site ID.
logId string sí Log ID.

Acceso: clave de API con el alcance log.read.

@owbase/node
import { Client, Sites } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const sites = new Sites(client);
const result = await sites.getLog({
siteId: '<SITE_ID>',
logId: '<LOG_ID>',
});

Eliminar log

DELETE /sites/{siteId}/logs/{logId} · página del método

SDK: solo @owbase/node

Delete a site log by its unique ID.

Parámetro Tipo Obligatorio Descripción
siteId string sí Site ID.
logId string sí Log ID.

Acceso: clave de API con el alcance log.write.

@owbase/node
import { Client, Sites } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const sites = new Sites(client);
const result = await sites.deleteLog({
siteId: '<SITE_ID>',
logId: '<LOG_ID>',
});

Listar variables

GET /sites/{siteId}/variables · página del método

SDK: solo @owbase/node

Get a list of all variables of a specific site.

Parámetro Tipo Obligatorio Descripción
siteId string sí Site unique ID.
queries string[] no Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, resourceType, resourceId, secret
total boolean no When set to false, the total count returned will be 0 and will not be calculated.

Acceso: clave de API con el alcance sites.read.

@owbase/node
import { Client, Sites } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const sites = new Sites(client);
const result = await sites.listVariables({
siteId: '<SITE_ID>',
queries: [], // optional
total: false, // optional
});

Crear variable

POST /sites/{siteId}/variables · página del método

SDK: solo @owbase/node

Create a new site variable. These variables can be accessed during build and runtime (server-side rendering) as environment variables.

Parámetro Tipo Obligatorio Descripción
siteId string sí Site unique ID.
variableId string sí Variable ID. Choose a custom ID or generate a random ID with ID.unique(). Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can’t start with a special char. Max length is 36 chars.
key string sí Variable key. Letters, digits and underscores only, must not start with a digit. Max length: 255 chars.
value string sí Variable value. Max length: 8192 chars.
secret boolean no Secret variables can be updated or deleted, but only sites can read them during build and runtime.
description string no Optional description for the variable.

Acceso: clave de API con el alcance sites.write.

@owbase/node
import { Client, Sites } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const sites = new Sites(client);
const result = await sites.createVariable({
siteId: '<SITE_ID>',
variableId: '<VARIABLE_ID>',
key: '<KEY>',
value: '<VALUE>',
secret: false, // optional
description: '<DESCRIPTION>', // optional
});

Obtener variable

GET /sites/{siteId}/variables/{variableId} · página del método

SDK: solo @owbase/node

Get a variable by its unique ID.

Parámetro Tipo Obligatorio Descripción
siteId string sí Site unique ID.
variableId string sí Variable unique ID.

Acceso: clave de API con el alcance sites.read.

@owbase/node
import { Client, Sites } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const sites = new Sites(client);
const result = await sites.getVariable({
siteId: '<SITE_ID>',
variableId: '<VARIABLE_ID>',
});

Actualizar variable

PUT /sites/{siteId}/variables/{variableId} · página del método

SDK: solo @owbase/node

Update variable by its unique ID.

Parámetro Tipo Obligatorio Descripción
siteId string sí Site unique ID.
variableId string sí Variable unique ID.
key string no Variable key. Letters, digits and underscores only, must not start with a digit. Max length: 255 chars.
value string no Variable value. Max length: 8192 chars.
secret boolean no Secret variables can be updated or deleted, but only sites can read them during build and runtime.
description string no Optional description for the variable.

Acceso: clave de API con el alcance sites.write.

@owbase/node
import { Client, Sites } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const sites = new Sites(client);
const result = await sites.updateVariable({
siteId: '<SITE_ID>',
variableId: '<VARIABLE_ID>',
key: '<KEY>', // optional
value: '<VALUE>', // optional
secret: false, // optional
description: '<DESCRIPTION>', // optional
});

Eliminar variable

DELETE /sites/{siteId}/variables/{variableId} · página del método

SDK: solo @owbase/node

Delete a variable by its unique ID.

Parámetro Tipo Obligatorio Descripción
siteId string sí Site unique ID.
variableId string sí Variable unique ID.

Acceso: clave de API con el alcance sites.write.

@owbase/node
import { Client, Sites } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const sites = new Sites(client);
const result = await sites.deleteVariable({
siteId: '<SITE_ID>',
variableId: '<VARIABLE_ID>',
});

Las descripciones de esta página vienen de la especificación de la API del servidor (licencia BSD-3-Clause), en inglés, y los ejemplos vienen del generador de SDKs (licencia MIT). Los avisos completos están en el archivo NOTICE de los paquetes @owbase/web y @owbase/node.

¿Te ayudó esta página?