Rosti API
Companies
Company in Rosti is something like a team. You have an account to access our system with a single set of email/password or token in case of the API. Each account has access to one or more companies. It means you can use different companies for your customers and give them and your teammates separate access to these companies.
You have access to multiple companies with a single access token. All API endpoints require company_id as a part of their URL. That's how you choose the company you want to work with.
When you register to our system your first company is created automatically and it has same name as your account. It's your default company.
Use companies list endpoint to gather list of companies you are registered in.
Authorization
API token can be generated only in web interface and it's implemented as the HTTP header called Authorization. The header looks like this:
Authorization: Token YOUR_TOKEN
Code deploying
Every application is just a description of the environment. But the environment itself is created by containers. Right now, each application has one container, but the API is ready to support more containers within a single application.
If you want to deploy a new code to your application, there are SSH connections, one for each container assigned to your application. You can connect to these SSH servers and upload anything you want there. You can use standard tools like rsync, tar or scp or you can use your own way to do deploys.
SSH access is full, but limited by local system user which is not root. You can run your scripts, use standard Linux tools, but it's not possible to use standard system package manager to install the new stuff. If you need a new stuff feel free to build it your self or use static linked version of tools you want.
Storage
Storage is something what holds your data. Right now it's used for databases and we support MariaDB and PostgreSQL. We generate name of the database and username to access the database, but password is set by you.
You can change the password anytime you want through this API or web interface. Passwords are managed by databases itself.
v1
apps > list
Returns list of applications. You can use SSH access to upload your code into the server. Keys can be updated via POST method.
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
company_id required |
apps > create
All application endpoints use same serializer, but only a few fields have to be send to this endpoint to create a new application. They are:
* name
* image
* plan
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
company_id required |
Request Body
The request body should be a "application/json"
encoded object, containing the following items.
Parameter | Description |
---|---|
name required | Name of the application. Choose well, because this is bound our system and can't be changed later. |
image required | Runtime tag. Use runtime endpoint to find the right one for your application. |
domains | List of domains separated by spaces. Leave blank to set a default domain based on the application name. |
mode | Set HTTP server mode. Use 'http' for HTTP only app 'https+le' for HTTPS covered by LE stuff. Wildcard is not support and LE is set by default if you omit this field. |
plan required | ID of one of our plans. Use plan endpoint to find the right one for you. |
app_port | Port on which your application is listening on. It can be between 1024 and 65536 except 8000. Default is 8080. This doesn't affect PHP apps because they are handled via PHP-FPM. |
ssh_keys | List of SSH keys which have access to this app. |
ssh_password | SSH password. No value is returned, use this just in case you want to set a new SSH password. |
apps > read
Returns a single application data. You need to know ID of the application.
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
company_id required | |
id required |
apps > update
It's not necessary to sent everything if you want to change only a single value. Send just the fields for parameters you wish to change. Based on received fields it's possible your application will be restarted.
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
company_id required | |
id required |
Request Body
The request body should be a "application/json"
encoded object, containing the following items.
Parameter | Description |
---|---|
image | Runtime tag. Use runtime endpoint to find the right one for your application. |
domains | List of domains separated by spaces. Leave blank to set a default domain based on the application name. |
mode | Set HTTP server mode. Use 'http' for HTTP only app 'https+le' for HTTPS covered by LE stuff. Wildcard is not support and LE is set by default if you omit this field. |
plan | ID of one of our plans. Use plan endpoint to find the right one for you. |
app_port | Port on which your application is listening on. It can be between 1024 and 65536 except 8000. Default is 8080. This doesn't affect PHP apps because they are handled via PHP-FPM. |
ssh_keys | List of SSH keys which have access to this app. |
ssh_password | SSH password. No value is returned, use this just in case you want to set a new SSH password. |
apps > delete
Simply destroys every related to the APP specified by id parameter which represents application ID.
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
company_id required | |
id required |
apps-action > update
This endpoint can be used for some actions related to applications. Right now there are three actions supported:
- start
- stop
- restart
- rebuild
If you stop the application the system removes all containers related to your application, but data are preserved and NOT removed. You can call start action anytime from now and the containers will be created again and app will start working. Restart doesn't destroy anything it just restarts all related containers.
If you want trigger full set of events like when start and stop is called you can use rebuild. It destroys all containers while data are preserved and the system creates the containers again. This action is used by our system mainly, but maybe you will find some use for it.
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
company_id required | |
id required |
Request Body
The request body should be a "application/json"
encoded object, containing the following items.
Parameter | Description |
---|---|
action required | Action you want to perform. Can be stop, start, restart or rebuild. |
apps-status > read
Returns information about status of an application. It helps you to identify if there is a problem with the code running inside your application or with DNS records of its domains.
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
company_id required | |
id required |
companies > list
Returns list of companies related to this token with their IDs. You can use these IDs to call other endpoints in this API.
plans > list
To create a new app you need to assign a plan and this endpoint gives you list of all available plans we have.
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
company_id required |
runtimes > list
To create a new app you need to know the runtime id and this list all of our available runtimes.
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
company_id required |
storages > list
Returns list of existing storages including information necessary to connect to the storage.
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
company_id required |
storages > create
Creates a new storage with a given storage type (mariadb/pgsql). Use these field to create the storage:
- storage_type
- password
Other fields are generated automatically. When it's done it returns data required to connect to the storage.
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
company_id required |
Request Body
The request body should be a "application/json"
encoded object, containing the following items.
Parameter | Description |
---|---|
type required | Storage type. Can be mariadb or pgsql. |
password required | Use this field to set a new password. |
note | A text describing this database |
storages > read
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
company_id required | |
id required |
storages > update
Sets a new password for the storage. Use password field for this endpoint.
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
company_id required | |
id required |
Request Body
The request body should be a "application/json"
encoded object, containing the following items.
Parameter | Description |
---|---|
password required | Use this field to set a new password. |
note | A text describing this database |
storages > delete
Simply destroys the storage identified by ID of the storage.
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
company_id required | |
id required |