Create Lambda

Creates a lambda with source code or static content and route metadata.

Authentication

Requires X-Glue-Authentication.

Request Body

Field Type Description
name string Human-readable lambda name
language string javascript, static-html, static-css, or static-js
code string Source code or static content
method string HTTP method for the lambda route
path string HTTP path for the lambda route

HTTP Request

 1POST /api/v0/lambdas HTTP/1.1
 2Host: api.hola.cloud
 3X-Glue-Authentication: YOUR_TOKEN
 4Content-Type: application/json
 5
 6{
 7  "name": "hello-world",
 8  "language": "javascript",
 9  "method": "GET",
10  "path": "/hello-world",
11  "code": "export default (req) => ({ body: { message: 'Hello, World!' } })"
12}

Example

 1curl -X POST "https://api.hola.cloud/api/v0/lambdas" \
 2  -H "X-Glue-Authentication: YOUR_TOKEN" \
 3  -H "Content-Type: application/json" \
 4  -d '{
 5    "name": "hello-world",
 6    "language": "javascript",
 7    "method": "GET",
 8    "path": "/hello-world",
 9    "code": "export default (req) => ({ body: { message: \"Hello, World!\" } })"
10  }'

Response

 1{
 2  "id": "f1a2b3c4-d5e6-7890-abcd-ef0123456789",
 3  "created_timestamp": 1751378400,
 4  "owner": "user_123",
 5  "project_id": "project_456",
 6  "name": "hello-world",
 7  "language": "javascript",
 8  "code": "export default (req) => ({ body: { message: \"Hello, World!\" } })",
 9  "method": "GET",
10  "path": "/hello-world"
11}

Error Codes

Code Description
400 Missing or invalid required fields
401 Missing or invalid authentication
409 A lambda with the same name already exists

Comments

Leave a comment