hostinger 2.5.0 Help

API

Hostinger uses the JMIX REST API Addon to provide a clean API Backend.

Authentication

Authentication runs via the OAuth protocol and is based on a client credentials and password credentials principle.

Get an authentication token

POST method/oauth/token

Gets an authentication token.

The endpoint is protected with the basic authentication. The request must contain an Authorization header for basic authentication with REST API client credentials. Please note that client credentials are not the same as the user credentials. Client means an application that uses the REST API.

Request parameters

Responses

{ "access_token": "ead2bcb0-6fed-42ec-8a8f-c3196d038d8b", "token_type": "password", "refresh_token": "fd00550e-5bb0-41b6-89d6-57bbfb6732a1", "expires_in": "3600", "scope": "rest-api" }
{ "error": "example", "error_description": "example" }
{ "error": "example", "error_description": "example" }

Revoke

Revoke an authentication token

POST method/oauth/revoke

Revokes an authentication token. The endpoint is protected with the basic authentication. The request must contain an Authorization header for basic authentication with REST API client credentials. See the /oauth/token endpoint documentation for more details. When the refresh token is revoked, the correspondig access token is also revoked. When the access token is revoked, the correspondding refresh token is also revoked.

Request parameters

Responses

Permissions

Get an information about current user security permissions

GET method/rest/permissions

Returns an object that contains lists of current user authorites (i.e. roles), permissions on CRUD operations with entities, entity attributes, specific permissions

Responses

{ "authorities": [ "ROLE_system-full-access", "..." ], "entityAttributes": [ { "target": "host_User:email", "value": 2 }, { "target": "...", "value": "..." } ], "entities": [ { "target": "host_User:create", "value": 1 }, { "target": "...", "value": "..." } ], "specifics": [ { "target": "rest.enabled", "value": 1 }, { "target": "...", "value": "..." } ] }

Local OpenAPI Specifications

Internal OpenAPI GUI

Since 1.1.50 you can view the OpenAPI Specifications of Hostinger or Modules in the UI without to download the Specs File.

api-docs.png

Swagger Editor

If you use a Module wich has no API Specifications but has an API Controller?

You can use the internal OpenAPI Generator to view Specs.

Following Routes are available:

  • http://localhost/rest/docs/internal

  • http://localhost/rest/docs/openapi.json

  • http://localhost/rest/docs/openapiDetailed.json

swagger-editor.png

Open SwaggerUi Editor

Last modified: 22 December 2024