/functions/{functionId}/executionsAlcance executions.writeTrigger a function execution. The returned object will return you the current execution status. You can ping the Get Execution endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously.
Parámetros
Sección titulada «Parámetros»functionId string obligatorio
Function ID.
body string
HTTP body of execution. Default value is empty string.
async boolean
Execute code in the background. Default value is false.
xpath string
HTTP path of execution. Path can include query params. Default value is /
method ExecutionMethod
HTTP method of execution. Default value is POST. Valores: GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD.
headers object
HTTP headers of execution. Defaults to empty.
scheduledAt string
Scheduled execution time in ISO 8601 format. DateTime value must be in future with precision in minutes.
Acceso: clave de API con el alcance executions.write (también acepta execution.write) o sesión del usuario, o incluso sin sesión (vale lo que permitan los permisos del recurso).
Respuestas
Sección titulada «Respuestas»201Éxito400Parámetro inválido o faltante401Sin sesión, sin permiso en el recurso o clave sin el alcance404Recurso de la ruta no encontrado429Límite de peticionesTodo error llega como JSON con code, type y message: consulta Errores.
import { Client, Functions, ExecutionMethod } from '@owbase/web';
const client = new Client() .setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>'); // Your project ID
const functions = new Functions(client);
const result = await functions.createExecution({ functionId: '<FUNCTION_ID>', body: '<BODY>', // optional async: false, // optional xpath: '<PATH>', // optional method: ExecutionMethod.GET, // optional headers: {}, // optional scheduledAt: '<SCHEDULED_AT>', // optional});
console.log(result);import { Client, Functions, ExecutionMethod } from '@owbase/node';
const client = new Client() .setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>') // Your project ID .setSession(''); // The user session to authenticate with
const functions = new Functions(client);
const result = await functions.createExecution({ functionId: '<FUNCTION_ID>', body: '<BODY>', // optional async: false, // optional xpath: '<PATH>', // optional method: ExecutionMethod.GET, // optional headers: {}, // optional scheduledAt: '<SCHEDULED_AT>', // optional});curl -X POST "https://cloud.owbase.dev/v1/functions/<FUNCTION_ID>/executions" \ -H "X-Owbase-Project: <PROJECT_ID>" \ -H "X-Owbase-Key: $OWBASE_API_KEY"{ "$id": "5e5ea5c16897e", "$createdAt": "2020-10-15T06:38:00.000+00:00", "$updatedAt": "2020-10-15T06:38:00.000+00:00", "$permissions": [ "any" ], "resourceId": "5e5ea6g16897e", "resourceType": "functions", "deploymentId": "5e5ea5c16897e", "trigger": "http", "status": "processing", "requestMethod": "GET", "requestPath": "/articles?id=5", "requestHeaders": [ { "name": "Content-Type", "value": "application/json" } ], "responseStatusCode": 200, "responseBody": "", "responseHeaders": [ { "name": "Content-Type", "value": "application/json" } ], "logs": "", "errors": "", "duration": 1.23, "scheduledAt": "2020-10-15T06:38:00.000+00:00"}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.