Ir al contenido
v2.7

Crear sitio

Create a new site.

POST/sitesAlcance sites.write

SDK: solo @owbase/node

Create a new site.

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

siteId string obligatorio

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 obligatorio

Site name. Max length: 128 chars.

framework Framework obligatorio

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 obligatorio

Runtime to use during build step. Valores: node-22 (solo Node 22 en Owbase).

enabled boolean

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

When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.

timeout number

Maximum request time in seconds.

installCommand string

Install Command.

buildCommand string

Build Command.

startCommand string

Custom start command. Leave empty to use default.

outputDirectory string

Output Directory for site.

adapter Adapter

Framework adapter defining rendering strategy. Allowed values are: static, ssr Valores: static, ssr.

fallbackFile string

Fallback file for single page application sites.

buildSpecification string

Build specification for the site deployments.

runtimeSpecification string

Runtime specification for the SSR executions.

deploymentRetention number

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[]

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

Optional description for the site.

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

201Éxito
400Parámetro inválido o faltante
401Sin sesión, sin permiso en el recurso o clave sin el alcance
429Límite de peticiones

Todo error llega como JSON con code, type y message: consulta Errores.

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
});
Respuesta201 Created
{
"$id": "5e5ea5c16897e",
"$createdAt": "2020-10-15T06:38:00.000+00:00",
"$updatedAt": "2020-10-15T06:38:00.000+00:00",
"name": "My Site",
"description": "Marketing site for the spring launch.",
"enabled": false,
"live": false,
"logging": false,
"framework": "react",
"deploymentRetention": 7,
"deploymentId": "5e5ea5c16897e",
"deploymentCreatedAt": "2020-10-15T06:38:00.000+00:00",
"deploymentScreenshotLight": "5e5ea5c16897e",
"deploymentScreenshotDark": "5e5ea5c16897e",
"latestDeploymentId": "5e5ea5c16897e",
"latestDeploymentCreatedAt": "2020-10-15T06:38:00.000+00:00",
"latestDeploymentStatus": "ready",
"scopes": [
"users.read"
],
"vars": [
{
"$id": "5e5ea5c16897e",
"$createdAt": "2020-10-15T06:38:00.000+00:00",
"$updatedAt": "2020-10-15T06:38:00.000+00:00",
"key": "API_KEY",
"description": "Stripe secret key used at checkout.",
"value": "myPa$$word1",
"secret": false,
"resourceType": "function",
"resourceId": "myAwesomeFunction"
}
],
"timeout": 300,
"installCommand": "npm install",
"buildCommand": "npm run build",
"startCommand": "node custom-server.mjs",
"outputDirectory": "build",
"installationId": "6m40at4ejk5h2u9s1hboo",
"providerRepositoryId": "owbase",
"providerBranch": "main",
"providerRootDirectory": "sites/helloWorld",
"providerSilentMode": false,
"providerBranches": [
"main",
"feat/*"
],
"providerPaths": [
"src/**",
"!docs/**"
],
"buildSpecification": "s-1vcpu-512mb",
"runtimeSpecification": "s-1vcpu-512mb",
"buildRuntime": "node-22",
"adapter": "static",
"fallbackFile": "index.html"
}

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?