Fake API

Fixed mock endpoints that serve Console development and demo data.

Description

The Console service exposes only the fake API routes listed below. These endpoints allow the UI to run without the real backend services. Paths not listed here are not part of the Console fake API.

Sub-routes

Method Path Description
GET /fakeapi/authapi/auth/me Returns the current mock user
GET /fakeapi/inceptionapi/v1/databases Lists mock databases
GET /fakeapi/inceptionapi/v1/databases/{databaseid}/collections Lists mock collections for a database
GET /fakeapi/lambdasapi/api/v0/lambdas Lists mock lambdas
GET /fakeapi/projectsapi/v0/projects Lists mock projects
GET /fakeapi/projectsapi/v0/projects/{projectid} Returns one mock project
GET /fakeapi/filesapi/v1/buckets Lists mock buckets

Authentication

None. These mock endpoints are unauthenticated.

Example

curl -X GET "https://api.hola.cloud/fakeapi/authapi/auth/me"
GET /fakeapi/authapi/auth/me HTTP/1.1
Host: api.hola.cloud
// Go 1.21+, standard library only. Save as main.go and run: go run main.go
package main

import (
	"fmt"
	"io"
	"net/http"
)

func main() {
	req, err := http.NewRequest("GET", "https://api.hola.cloud/fakeapi/authapi/auth/me", 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(resp.Status)
	fmt.Println(string(responseBody))
}
<?php
// PHP 8+ with the curl extension. Save as example.php and run: php example.php

$ch = curl_init();

curl_setopt_array($ch, [
    CURLOPT_URL => 'https://api.hola.cloud/fakeapi/authapi/auth/me',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'GET',
]);

$response = curl_exec($ch);
if ($response === false) {
    throw new Exception(curl_error($ch));
}
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), "\n", $response, "\n";
curl_close($ch);
# Python 3.8+. Install: pip install requests. Save as example.py and run: python example.py
import requests

response = requests.request(
    "GET",
    "https://api.hola.cloud/fakeapi/authapi/auth/me"
)

print(response.status_code)
print(response.text)
// Node.js 18+. Save as example.mjs and run: node example.mjs
const response = await fetch("https://api.hola.cloud/fakeapi/authapi/auth/me", {
  method: "GET"
});

console.log(response.status);
console.log(await response.text());
const response = await fetch("https://api.hola.cloud/fakeapi/authapi/auth/me", {
  method: "GET"
});

console.log(response.status);
console.log(await response.text());
// Java 17+, standard library only. Save as Main.java and run: java Main.java
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/fakeapi/authapi/auth/me"))
            .method("GET", HttpRequest.BodyPublishers.noBody())
            .build();

        var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.statusCode());
        System.out.println(response.body());
    }
}
1{
2  "email": "fulanez@gmail.com",
3  "id": "user-1234",
4  "nick": "fulanez",
5  "picture": "https://lh3.googleusercontent.com/a-/ACNPEu8h8e8wfcL1Hsk4JbFsROFXIBNIllOFLLPnWEDWV2s=s96-c"
6}
curl -X GET "https://api.hola.cloud/fakeapi/projectsapi/v0/projects"
GET /fakeapi/projectsapi/v0/projects HTTP/1.1
Host: api.hola.cloud
// Go 1.21+, standard library only. Save as main.go and run: go run main.go
package main

import (
	"fmt"
	"io"
	"net/http"
)

func main() {
	req, err := http.NewRequest("GET", "https://api.hola.cloud/fakeapi/projectsapi/v0/projects", 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(resp.Status)
	fmt.Println(string(responseBody))
}
<?php
// PHP 8+ with the curl extension. Save as example.php and run: php example.php

$ch = curl_init();

curl_setopt_array($ch, [
    CURLOPT_URL => 'https://api.hola.cloud/fakeapi/projectsapi/v0/projects',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'GET',
]);

$response = curl_exec($ch);
if ($response === false) {
    throw new Exception(curl_error($ch));
}
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), "\n", $response, "\n";
curl_close($ch);
# Python 3.8+. Install: pip install requests. Save as example.py and run: python example.py
import requests

response = requests.request(
    "GET",
    "https://api.hola.cloud/fakeapi/projectsapi/v0/projects"
)

print(response.status_code)
print(response.text)
// Node.js 18+. Save as example.mjs and run: node example.mjs
const response = await fetch("https://api.hola.cloud/fakeapi/projectsapi/v0/projects", {
  method: "GET"
});

console.log(response.status);
console.log(await response.text());
const response = await fetch("https://api.hola.cloud/fakeapi/projectsapi/v0/projects", {
  method: "GET"
});

console.log(response.status);
console.log(await response.text());
// Java 17+, standard library only. Save as Main.java and run: java Main.java
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/fakeapi/projectsapi/v0/projects"))
            .method("GET", HttpRequest.BodyPublishers.noBody())
            .build();

        var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.statusCode());
        System.out.println(response.body());
    }
}
1[
2  {
3    "id": "project-00000000-0000-0000-0000-000000000001",
4    "name": "Hello",
5    "host": "red-pepper.holacloud.app",
6    "owners": ["user1"]
7  }
8]
curl -X GET "https://api.hola.cloud/fakeapi/lambdasapi/api/v0/lambdas"
GET /fakeapi/lambdasapi/api/v0/lambdas HTTP/1.1
Host: api.hola.cloud
// Go 1.21+, standard library only. Save as main.go and run: go run main.go
package main

import (
	"fmt"
	"io"
	"net/http"
)

func main() {
	req, err := http.NewRequest("GET", "https://api.hola.cloud/fakeapi/lambdasapi/api/v0/lambdas", 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(resp.Status)
	fmt.Println(string(responseBody))
}
<?php
// PHP 8+ with the curl extension. Save as example.php and run: php example.php

$ch = curl_init();

curl_setopt_array($ch, [
    CURLOPT_URL => 'https://api.hola.cloud/fakeapi/lambdasapi/api/v0/lambdas',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'GET',
]);

$response = curl_exec($ch);
if ($response === false) {
    throw new Exception(curl_error($ch));
}
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), "\n", $response, "\n";
curl_close($ch);
# Python 3.8+. Install: pip install requests. Save as example.py and run: python example.py
import requests

response = requests.request(
    "GET",
    "https://api.hola.cloud/fakeapi/lambdasapi/api/v0/lambdas"
)

print(response.status_code)
print(response.text)
// Node.js 18+. Save as example.mjs and run: node example.mjs
const response = await fetch("https://api.hola.cloud/fakeapi/lambdasapi/api/v0/lambdas", {
  method: "GET"
});

console.log(response.status);
console.log(await response.text());
const response = await fetch("https://api.hola.cloud/fakeapi/lambdasapi/api/v0/lambdas", {
  method: "GET"
});

console.log(response.status);
console.log(await response.text());
// Java 17+, standard library only. Save as Main.java and run: java Main.java
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/fakeapi/lambdasapi/api/v0/lambdas"))
            .method("GET", HttpRequest.BodyPublishers.noBody())
            .build();

        var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.statusCode());
        System.out.println(response.body());
    }
}
1[
2  {
3    "id": "a663e1f1-e5cb-4fc2-b846-53f2cc7574c9",
4    "method": "GET",
5    "name": "Index",
6    "path": "/"
7  }
8]

Error Codes

Code Description
200 Mock data returned successfully
404 Path under /fakeapi/ not recognized

Comments

Leave a comment