Invoking Lambda Functions
HolaCloud Lambda supports direct admin calls, public calls, owner-scoped mux routes, and a small set of service inspection endpoints.
Admin Invocation
Use /api/v0/run/{lambda_id} when the client can send X-Glue-Authentication. The endpoint accepts any HTTP method.
curl -X POST "https://api.hola.cloud/api/v0/run/YOUR_LAMBDA_ID" \
-H "X-Glue-Authentication: YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"key": "value"
}'POST /api/v0/run/YOUR_LAMBDA_ID HTTP/1.1
Host: api.hola.cloud
X-Glue-Authentication: YOUR_TOKEN
Content-Type: application/json
{
"key": "value"
}package main
import (
"fmt"
"io"
"net/http"
"encoding/json"
"strings"
)
func main() {
payload := map[string]any{"key": "value"}
bodyBytes, err := json.Marshal(payload)
if err != nil {
panic(err)
}
body := string(bodyBytes)
req, err := http.NewRequest("POST", "https://api.hola.cloud/api/v0/run/YOUR_LAMBDA_ID", strings.NewReader(body))
if err != nil {
panic(err)
}
req.Header.Set("X-Glue-Authentication", "YOUR_TOKEN")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
responseBody, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(responseBody))
}
<?php
$payload = ['key' => 'value'];
$body = json_encode($payload);
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api.hola.cloud/api/v0/run/YOUR_LAMBDA_ID',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => $body,
CURLOPT_HTTPHEADER => [
'X-Glue-Authentication: YOUR_TOKEN',
'Content-Type: application/json',
],
]);
$response = curl_exec($ch);
if ($response === false) {
throw new Exception(curl_error($ch));
}
curl_close($ch);
echo $response;
import requests
import json
headers = {
"X-Glue-Authentication": "YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {"key": "value"}
body = json.dumps(payload)
response = requests.request(
"POST",
"https://api.hola.cloud/api/v0/run/YOUR_LAMBDA_ID",
headers=headers,
data=body
)
print(response.text)
const payload = {"key": "value"};
const response = await fetch("https://api.hola.cloud/api/v0/run/YOUR_LAMBDA_ID", {
method: "POST",
headers: {
"X-Glue-Authentication": "YOUR_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify(payload)
});
console.log(await response.text());
const payload = {"key": "value"};
const response = await fetch("https://api.hola.cloud/api/v0/run/YOUR_LAMBDA_ID", {
method: "POST",
headers: {
"X-Glue-Authentication": "YOUR_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify(payload)
});
const text = await response.text();
console.log(text);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.Map;
import java.util.List;
public class Main {
public static void main(String[] args) throws Exception {
var payload = Map.of("key", "value");
var body = new ObjectMapper().writeValueAsString(payload);
var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.hola.cloud/api/v0/run/YOUR_LAMBDA_ID"))
.method("POST", HttpRequest.BodyPublishers.ofString(body))
.header("X-Glue-Authentication", "YOUR_TOKEN")
.header("Content-Type", "application/json")
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}Public Invocation
Use /run/{lambda_id} for webhooks, browser calls, and other clients that should not send admin credentials. The endpoint accepts any HTTP method.
curl -X POST "https://api.hola.cloud/run/YOUR_LAMBDA_ID" \
-H "Content-Type: application/json" \
-d '{
"key": "value"
}'POST /run/YOUR_LAMBDA_ID HTTP/1.1
Host: api.hola.cloud
Content-Type: application/json
{
"key": "value"
}package main
import (
"fmt"
"io"
"net/http"
"encoding/json"
"strings"
)
func main() {
payload := map[string]any{"key": "value"}
bodyBytes, err := json.Marshal(payload)
if err != nil {
panic(err)
}
body := string(bodyBytes)
req, err := http.NewRequest("POST", "https://api.hola.cloud/run/YOUR_LAMBDA_ID", strings.NewReader(body))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
responseBody, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(responseBody))
}
<?php
$payload = ['key' => 'value'];
$body = json_encode($payload);
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api.hola.cloud/run/YOUR_LAMBDA_ID',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => $body,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
],
]);
$response = curl_exec($ch);
if ($response === false) {
throw new Exception(curl_error($ch));
}
curl_close($ch);
echo $response;
import requests
import json
headers = {
"Content-Type": "application/json",
}
payload = {"key": "value"}
body = json.dumps(payload)
response = requests.request(
"POST",
"https://api.hola.cloud/run/YOUR_LAMBDA_ID",
headers=headers,
data=body
)
print(response.text)
const payload = {"key": "value"};
const response = await fetch("https://api.hola.cloud/run/YOUR_LAMBDA_ID", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(payload)
});
console.log(await response.text());
const payload = {"key": "value"};
const response = await fetch("https://api.hola.cloud/run/YOUR_LAMBDA_ID", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(payload)
});
const text = await response.text();
console.log(text);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.Map;
import java.util.List;
public class Main {
public static void main(String[] args) throws Exception {
var payload = Map.of("key", "value");
var body = new ObjectMapper().writeValueAsString(payload);
var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.hola.cloud/run/YOUR_LAMBDA_ID"))
.method("POST", HttpRequest.BodyPublishers.ofString(body))
.header("Content-Type", "application/json")
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}The lambda receives request data through req, including the request method, path, headers, query values, and body.
Webhook Usage
Configure an external service to send events to:
1https://api.hola.cloud/run/YOUR_LAMBDA_ID
Example webhook handler:
1export default (req) => {
2 return {
3 body: {
4 received: true,
5 event: req.headers["x-github-event"],
6 payload: req.body
7 }
8 };
9};
Mux Router
The mux router forwards owner-scoped routes through /mux/{owner_id}/*. It accepts any HTTP method.
curl -X GET "https://api.hola.cloud/mux/OWNER_ID/any/path/here"GET /mux/OWNER_ID/any/path/here HTTP/1.1
Host: api.hola.cloud
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, err := http.NewRequest("GET", "https://api.hola.cloud/mux/OWNER_ID/any/path/here", nil)
if err != nil {
panic(err)
}
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
responseBody, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(responseBody))
}
<?php
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api.hola.cloud/mux/OWNER_ID/any/path/here',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
]);
$response = curl_exec($ch);
if ($response === false) {
throw new Exception(curl_error($ch));
}
curl_close($ch);
echo $response;
import requests
response = requests.request(
"GET",
"https://api.hola.cloud/mux/OWNER_ID/any/path/here"
)
print(response.text)
const response = await fetch("https://api.hola.cloud/mux/OWNER_ID/any/path/here", {
method: "GET"
});
console.log(await response.text());
const response = await fetch("https://api.hola.cloud/mux/OWNER_ID/any/path/here", {
method: "GET"
});
const text = await response.text();
console.log(text);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.hola.cloud/mux/OWNER_ID/any/path/here"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}The owner_id identifies the HolaCloud owner. The remaining path is forwarded to the lambda routing logic.
Ongoing Invocations
Check currently running invocations:
curl "https://api.hola.cloud/ongoing"GET /ongoing HTTP/1.1
Host: api.hola.cloud
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, err := http.NewRequest("GET", "https://api.hola.cloud/ongoing", nil)
if err != nil {
panic(err)
}
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
responseBody, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(responseBody))
}
<?php
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api.hola.cloud/ongoing',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
]);
$response = curl_exec($ch);
if ($response === false) {
throw new Exception(curl_error($ch));
}
curl_close($ch);
echo $response;
import requests
response = requests.request(
"GET",
"https://api.hola.cloud/ongoing"
)
print(response.text)
const response = await fetch("https://api.hola.cloud/ongoing", {
method: "GET"
});
console.log(await response.text());
const response = await fetch("https://api.hola.cloud/ongoing", {
method: "GET"
});
const text = await response.text();
console.log(text);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.hola.cloud/ongoing"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}Current User
The /me endpoint returns information for the authenticated user:
curl "https://api.hola.cloud/me" \
-H "X-Glue-Authentication: YOUR_TOKEN"GET /me HTTP/1.1
Host: api.hola.cloud
X-Glue-Authentication: YOUR_TOKEN
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, err := http.NewRequest("GET", "https://api.hola.cloud/me", nil)
if err != nil {
panic(err)
}
req.Header.Set("X-Glue-Authentication", "YOUR_TOKEN")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
responseBody, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(responseBody))
}
<?php
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api.hola.cloud/me',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => [
'X-Glue-Authentication: YOUR_TOKEN',
],
]);
$response = curl_exec($ch);
if ($response === false) {
throw new Exception(curl_error($ch));
}
curl_close($ch);
echo $response;
import requests
headers = {
"X-Glue-Authentication": "YOUR_TOKEN",
}
response = requests.request(
"GET",
"https://api.hola.cloud/me",
headers=headers
)
print(response.text)
const response = await fetch("https://api.hola.cloud/me", {
method: "GET",
headers: {
"X-Glue-Authentication": "YOUR_TOKEN"
}
});
console.log(await response.text());
const response = await fetch("https://api.hola.cloud/me", {
method: "GET",
headers: {
"X-Glue-Authentication": "YOUR_TOKEN"
}
});
const text = await response.text();
console.log(text);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.hola.cloud/me"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.header("X-Glue-Authentication", "YOUR_TOKEN")
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}OpenAPI Specification
HolaCloud exposes the Lambda OpenAPI document at:
curl -X GET "https://api.hola.cloud/openapi"GET /openapi HTTP/1.1
Host: api.hola.cloud
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, err := http.NewRequest("GET", "https://api.hola.cloud/openapi", nil)
if err != nil {
panic(err)
}
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
responseBody, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(responseBody))
}
<?php
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api.hola.cloud/openapi',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
]);
$response = curl_exec($ch);
if ($response === false) {
throw new Exception(curl_error($ch));
}
curl_close($ch);
echo $response;
import requests
response = requests.request(
"GET",
"https://api.hola.cloud/openapi"
)
print(response.text)
const response = await fetch("https://api.hola.cloud/openapi", {
method: "GET"
});
console.log(await response.text());
const response = await fetch("https://api.hola.cloud/openapi", {
method: "GET"
});
const text = await response.text();
console.log(text);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.hola.cloud/openapi"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
Comments