Skip to content

Admin Rest API

Thiago Bustamante edited this page May 18, 2017 · 11 revisions

It is important that you enable the "admin" service in the "gateway" on your tree-gateway.json file. If you do not enable it, no configuration can be done through this gateway instance.

Note that you can have this configuration enabled just for some machines (maybe located in a separated network).

The following configuration enables the admin service to listen, via https, the port 8001 and expose the API docs on path https://localhost:8001/api-docs:

{
    "admin": {
        "protocol": {
            "https": {
                "listenPort": 8001,
                "privateKey": "./server.key",
                "certificate": "./server.crt"                        
            }
        },
        "userService": {
            "jwtSecret": "secret"
        },
        "apiDocs": {
            "path": "api-docs",
            "host": "localhost"
        }
    }
}

Accessing this URL https://localhost:8001/api-docs, you can see the swagger-ui interface, that allows you to explore and interact with the API.

You can also access the API swagger file through:

http://localhost:8001/api-docs/json
or
http://localhost:8001/api-docs/yaml

Note that you need to provide an access token to all methods on the Admin API. To obtain this token, you must authenticate with the user you created in the previous step, by calling the endpoint:

http://localhost:8001/users/authentication

Note that you can authenticate through the swagger-ui interface.

Clone this wiki locally