Skip to content

API: make public API endpoints easy to setup #271

@witoldsz

Description

@witoldsz

🚀 Feature Request

In order to make public API endpoints easy to set up, we must do everything to:

  • minimize the work required to setup the environment (just use a reverse proxy with a certificate and point it to the host/port/path and that's it)
  • to maximize the compatibility between providers

Now there are two public servers providing Semux API:

Both use very different approach and software:

These projects were created because Semux Core is missing dedicated endpoint serving nothing but public API, where one:

  • does not need to authenticate
  • does not have access to wallet of the Semux node
  • does not see non-public endpoints in the swagger-generated page and the specification file

Current solution

In my opinion, the API: divide APIs into groups #267 is not a good solution:

  • does little to help setup a public API endpoint,
  • does assume that from now on, each and every public endpoint must be GET and wallet endpoint must NOT be GET,
  • is confusing, e.g. the extra comment in config file:
    # Allow GET methods (safe for public access) only
    api.allowGetMethodsOnly = true
    
    for no reason in the Semux API jargon, allowGetMethodsOnly equals publicMethodsOnly

Suggestions

  1. rollback the GET=public rule
  2. make it so that once we setup reverse proxy, there is nothing but public API with no wallet endpoints, no authentication sections, etc…

We can either:

  • setup separate public API from wallet API (two swagger files, two root paths)
  • or just mark each endpoint (public or wallet) and let the Semux Core generate the proper API page+endpints according to some settings like api.publicOnly=true.

The first approach has an advantage that one can publish public API (e.g. reverse proxy points to host:port/api/public) and still use wallet API internally.

The latter approach is implemented in https://github.com/witoldsz/api.semux.online by filtering the swagger specification file. @orogvany said:

Swagger has API so no manual filtering necessary

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementAn enhancement to existing implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions