Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 56 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,66 +5,60 @@
This is an attempt to improve Hetzner's own OpenAPI specification to make it usable in code generation.

When this project was started, Hetzner had not published their own OpenAPI specification for their cloud API, so I decided to build my own based on the HTML documentation on their website.
Luckily, Hetzner has actually published an [OpenAPI spec for their API](https://docs.hetzner.cloud/cloud.spec.json) in the meantime but I think this project still adds some value.
By now, Hetzner has actually published an [OpenAPI spec for their Cloud API](https://docs.hetzner.cloud/cloud.spec.json) and recently also [the Hetzner API](https://docs.hetzner.cloud/hetzner.spec.json) However, I think this project still adds some value.

While Hetzner now appears to generate their documentation website from the OpenAPI spec, the spec is not very useful for automatic code generation.
This project aims to convert the official spec to an improved version with the following main features:
This project aims to convert the official specs to an improved version with the following main features:

- A single file describing all API endpoints from multiple source documents
- Definition of common components that are reused throughout the schema
- Added pagination support
- API-friendly tag names
- Unique `operationId`s

As an added benefit, mainly from use of common components, the improved spec is much smaller (548 KiB vs 1.4 MiB) than the original.
As an added benefit, mainly from use of common components, the improved spec is much smaller (945 KB vs 2.291 MB) than the original.

## Further Reading

- [Link to the generated openAPI document](openapi/hcloud.json)
- [Official API documentation](https://docs.hetzner.cloud/)
- [OpenAPI spec document provided by Hetzner](https://docs.hetzner.cloud/cloud.spec.json)
- [OpenAPI spec document provided by Hetzner for the Hetzner Cloud API](https://docs.hetzner.cloud/cloud.spec.json)
- [OpenAPI spec document provided by Hetzner for the Hetzner API](https://docs.hetzner.cloud/hetzner.spec.json)
- [OpenAPI standard](https://swagger.io/specification/)

## Use Cases

This API description is currently being used by the following projects:

- [hcloud-rust](https://github.com/HenningHolmDE/hcloud-rust)
[![Crates.io](https://img.shields.io/crates/v/hcloud.svg)](https://crates.io/crates/hcloud)
[![Documentation](https://docs.rs/hcloud/badge.svg)](https://docs.rs/hcloud/)

## Supported Endpoints
<table style="text-align: center">
<tr height="80">
<td>actions</td>
<td>certificates</td>
<td>datacenters</td>
</tr>
<tr height="80">
<td>floating_ips</td>
<td>images</td>
<td>isos</td>
</tr>
<tr height="80">
<td>load_balancer_types</td>
<td>load_balancers</td>
<td>locations</td>
</tr>
<tr height="80">
<td>networks</td>
<td>pricing</td>
<td>server_types</td>
</tr>
<tr height="80">
<td>servers</td>
<td>ssh_keys</td>
<td>volumes</td>
</tr>
<tr height="80">
<td>firewalls</td>
<td>placement_groups</td>
<td>primary_ips</td>
</tr>
</table>

- actions
- certificates
- datacenters
- firewalls
- floating_ips
- images
- isos
- load_balancer_types
- load_balancers
- locations
- networks
- placement_groups
- pricing
- primary_ips
- server_types
- servers
- ssh_keys
- storage_box_types
- storage_boxes
- volumes

```
# Main hcloud API

/actions (GET)
/actions/{id} (GET)
/certificates (GET, POST)
Expand Down Expand Up @@ -195,6 +189,31 @@ This API description is currently being used by the following projects:
/volumes/{id}/actions/resize (POST)
/volumes/actions (GET)
/volumes/actions/{id} (GET)

# Storage Boxes

/storage_box_types (GET)
/storage_box_types/{id} (GET)
/storage_boxes (GET, POST)
/storage_boxes/actions (GET)
/storage_boxes/actions/{id} (GET)
/storage_boxes/{id} (DELETE, GET, PUT)
/storage_boxes/{id}/actions (GET)
/storage_boxes/{id}/actions/change_protection (POST)
/storage_boxes/{id}/actions/change_type (POST)
/storage_boxes/{id}/actions/disable_snapshot_plan (POST)
/storage_boxes/{id}/actions/enable_snapshot_plan (POST)
/storage_boxes/{id}/actions/reset_password (POST)
/storage_boxes/{id}/actions/rollback_snapshot (POST)
/storage_boxes/{id}/actions/update_access_settings (POST)
/storage_boxes/{id}/actions/{action_id} (GET)
/storage_boxes/{id}/folders (GET)
/storage_boxes/{id}/snapshots (GET, POST)
/storage_boxes/{id}/snapshots/{snapshot_id} (DELETE, GET, PUT)
/storage_boxes/{id}/subaccounts (GET, POST)
/storage_boxes/{id}/subaccounts/{subaccount_id} (DELETE, GET, PUT)
/storage_boxes/{id}/subaccounts/{subaccount_id}/actions/reset_subaccount_password (POST)
/storage_boxes/{id}/subaccounts/{subaccount_id}/actions/update_access_settings (POST)
```

## Quick Start
Expand Down
Loading