Openapi Spec

Returns the OpenAPI specification for the Glue2 gateway.

Description

This endpoint serves the OpenAPI 3.0 specification document that describes all routes, request formats, and response schemas exposed by the gateway. The specification is auto-generated from the route definitions.

Authentication

None. This endpoint is public.

Request

No request body required.

Example

curl -X GET "https://api.hola.cloud/openapi.json"
GET /openapi.json 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/openapi.json", 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/openapi.json',
    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/openapi.json"
)

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/openapi.json", {
  method: "GET"
});

console.log(response.status);
console.log(await response.text());
const response = await fetch("https://api.hola.cloud/openapi.json", {
  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/openapi.json"))
            .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());
    }
}

Response

 1{
 2  "openapi": "3.0.3",
 3  "info": {
 4    "title": "Glue2 API Gateway",
 5    "version": "2.3.1",
 6    "description": "Central API gateway for HolaCloud services"
 7  },
 8  "paths": {
 9    "/version": {
10      "get": {
11        "summary": "Get gateway version",
12        "responses": {
13          "200": {
14            "description": "Version information"
15          }
16        }
17      }
18    },
19    "/v0/virtualhosts": {
20      "get": {
21        "summary": "List virtual hosts",
22        "responses": {
23          "200": {
24            "description": "Routing table"
25          }
26        }
27      }
28    },
29    "/v0/stats": {
30      "get": {
31        "summary": "Get traffic stats",
32        "responses": {
33          "200": {
34            "description": "Traffic statistics"
35          }
36        }
37      }
38    },
39    "/v0/status": {
40      "get": {
41        "summary": "Backend health status",
42        "responses": {
43          "200": {
44            "description": "Service status"
45          }
46        }
47      }
48    }
49  }
50}

Error Codes

Code Description
200 OpenAPI specification returned successfully

Comments

Leave a comment