FLECS
HomeMarketplaceRessourcesGet started
Engineering
Engineering
  • API Docs
    • FLECS Console API
      • Welcome!
      • Quick Start
      • API Reference
        • Authentication
        • Users
        • Products
        • Device
        • Apps
    • FLECS Core API
      • API Reference
        • System
        • Device
        • Console
        • Instances
        • Apps
        • Jobs
  • App Publishing Guide
    • 💡Overview
    • 🪛How to create a FLECS app
    • 🚀How to release a FLECS app
    • 🧳App Publishing Packages
    • 📶Network
  • FLECS Core
    • Install FLECS Core Using Docker
  • White Labeling
    • Integrate views
    • On-premise hosting of apps
Powered by GitBook
On this page

Was this helpful?

  1. API Docs
  2. FLECS Core API
  3. API Reference

Instances

PreviousConsoleNextApps

Last updated 3 months ago

Was this helpful?

Query all instances of one or all Apps

get
Query parameters
appstringOptional

App to query instances for

versionstringOptional

App version to query instances for

Responses
200
Success
application/json
get
GET /v2/instances HTTP/1.1
Host: localhost
Accept: */*
200

Success

[]

Obtain details of an App instance

get
Path parameters
instance_idstringRequiredExample: 01ab89efPattern: ^[0-9a-f]{8}$
Responses
200
Success
application/json
404
No instance with this instance_id found
500
Internal server error
application/json
get
GET /v2/instances/{instance_id} HTTP/1.1
Host: localhost
Accept: */*
{
  "instanceId": "01ab89ef",
  "instanceName": "Smart home",
  "appKey": {
    "name": "tech.flecs.app-1",
    "version": "1.2.3.4-f1"
  },
  "status": "not created",
  "desired": "not created",
  "configFiles": [
    {
      "container": "/etc/conf.d/configuration.cfg",
      "host": "/var/lib/flecs/instances/01ab89ef/conf/configuration.cfg"
    }
  ],
  "hostname": "flecs-01ab89ef",
  "ipAddress": "172.21.0.3",
  "ports": [
    {
      "container": "8080",
      "host": "18080"
    }
  ],
  "volumes": [
    {
      "name": "var",
      "path": "/var/app"
    }
  ],
  "editors": [
    {
      "name": "Example app user settings",
      "url": "/api/v2/instances/abcd1234/editor/8080"
    }
  ]
}

Delete a single instance

delete
Path parameters
instance_idstringRequiredExample: 01ab89efPattern: ^[0-9a-f]{8}$
Responses
202
Accepted
application/json
404
No instance with this instance_id found
delete
DELETE /v2/instances/{instance_id} HTTP/1.1
Host: localhost
Accept: */*
{
  "jobId": 17
}

Start an App instance

post
Path parameters
instance_idstringRequiredExample: 01ab89efPattern: ^[0-9a-f]{8}$
Responses
202
Accepted
application/json
404
No instance with this instance_id found
post
POST /v2/instances/{instance_id}/start HTTP/1.1
Host: localhost
Accept: */*
{
  "jobId": 17
}

Stop an App instance

post
Path parameters
instance_idstringRequired

Instance id to delete

Responses
202
Accepted
application/json
404
No instance with this instance_id found
post
POST /v2/instances/{instance_id}/stop HTTP/1.1
Host: localhost
Accept: */*
{
  "jobId": 17
}

Get configuration of an Instance

get
Path parameters
instance_idstringRequired
Responses
200
Success
application/json
404
No instance with this instance_id found
get
GET /v2/instances/{instance_id}/config HTTP/1.1
Host: localhost
Accept: */*
{
  "networkAdapters": [
    {
      "name": "text",
      "active": true,
      "connected": true,
      "ipAddress": "0.0.0.0",
      "subnetMask": "0.0.0.0",
      "gateway": "0.0.0.0"
    }
  ],
  "devices": {
    "usb": [
      {
        "device": "text",
        "pid": 1,
        "port": "text",
        "vendor": "text",
        "vid": 1,
        "active": true,
        "connected": true
      }
    ]
  }
}

Retrieve logs of an Instance

get
Path parameters
instance_idstringRequired
Responses
200
Success
application/json
404
No instance with this instance_id found
500
Internal server error
application/json
get
GET /v2/instances/{instance_id}/logs HTTP/1.1
Host: localhost
Accept: */*
{
  "stdout": "text",
  "stderr": "text"
}

Retrieve environment of an instance

get
Path parameters
instance_idstringRequired
Responses
200
Success
application/json
Responsestring[]
404
No instance with this instance_id found
get
GET /v2/instances/{instance_id}/config/environment HTTP/1.1
Host: localhost
Accept: */*
[
  "text"
]

Delete environment of an instance

delete
Path parameters
instance_idstringRequired
Responses
200
Environment of instance with this instance_id was deleted
404
No instance with this instance_id found
delete
DELETE /v2/instances/{instance_id}/config/environment HTTP/1.1
Host: localhost
Accept: */*

No content

Retrieve exposed ports of an instance

get
Path parameters
instance_idstringRequired
Responses
200
Success
application/json
Responsestring[]Example: ["8001:8001","5000","5001-5008:6001-6008","6001-6008"]
404
No instance with this instance_id found
get
GET /v2/instances/{instance_id}/config/ports HTTP/1.1
Host: localhost
Accept: */*
[
  "8001:8001",
  "5000",
  "5001-5008:6001-6008",
  "6001-6008"
]

Delete exposed ports of an instance

delete
Path parameters
instance_idstringRequired
Responses
200
Exposed ports of instance with this instance_id was deleted
404
No instance with this instance_id found
delete
DELETE /v2/instances/{instance_id}/config/ports HTTP/1.1
Host: localhost
Accept: */*

No content

Access an editor of an app

get
Path parameters
instance_idstringRequiredExample: 01ab89efPattern: ^[0-9a-f]{8}$
portinteger · min: 1 · max: 65535Required
Responses
302
Found
400
Malformed request
application/json
404
Instance id or port not found
application/json
500
Internal server error
application/json
get
GET /v2/instances/{instance_id}/editor/{port} HTTP/1.1
Host: localhost
Accept: */*

No content

  • GETQuery all instances of one or all Apps
  • GETObtain details of an App instance
  • PATCHUpdate or downgrade Instance to another App version
  • DELETEDelete a single instance
  • POSTCreate new instance of an installed App
  • POSTStart an App instance
  • POSTStop an App instance
  • GETGet configuration of an Instance
  • POSTUpdate configuration of an Instance
  • GETRetrieve logs of an Instance
  • GETRetrieve environment of an instance
  • PUTModify or create environment of an instance
  • DELETEDelete environment of an instance
  • GETRetrieve exposed ports of an instance
  • DELETEDelete exposed ports of an instance
  • GETAccess an editor of an app
  • PUTModify or create exposed ports of an instance

Update or downgrade Instance to another App version

patch
Path parameters
instance_idstringRequiredExample: 01ab89efPattern: ^[0-9a-f]{8}$
Body
tostringRequired
Responses
202
Accepted
application/json
404
No instance with this instance_id found
patch
PATCH /v2/instances/{instance_id} HTTP/1.1
Host: localhost
Content-Type: application/json
Accept: */*
Content-Length: 13

{
  "to": "text"
}
{
  "jobId": 17
}

Create new instance of an installed App

post
Body
instanceNamestringOptional

Instance name

Example: Smart home
Responses
202
Accepted
application/json
400
Malformed request
application/json
post
POST /v2/instances/create HTTP/1.1
Host: localhost
Content-Type: application/json
Accept: */*
Content-Length: 89

{
  "appKey": {
    "name": "tech.flecs.app-1",
    "version": "1.2.3.4-f1"
  },
  "instanceName": "Smart home"
}
{
  "jobId": 17
}

Update configuration of an Instance

post
Path parameters
instance_idstringRequired
Body
Responses
200
Success
application/json
404
No instance with this instance_id found
post
POST /v2/instances/{instance_id}/config HTTP/1.1
Host: localhost
Content-Type: application/json
Accept: */*
Content-Length: 248

{
  "networkAdapters": [
    {
      "name": "text",
      "active": true,
      "connected": true,
      "ipAddress": "0.0.0.0",
      "subnetMask": "0.0.0.0",
      "gateway": "0.0.0.0"
    }
  ],
  "devices": {
    "usb": [
      {
        "device": "text",
        "pid": 1,
        "port": "text",
        "vendor": "text",
        "vid": 1,
        "active": true,
        "connected": true
      }
    ]
  }
}
{
  "networkAdapters": [
    {
      "name": "text",
      "active": true,
      "connected": true,
      "ipAddress": "0.0.0.0",
      "subnetMask": "0.0.0.0",
      "gateway": "0.0.0.0"
    }
  ],
  "devices": {
    "usb": [
      {
        "device": "text",
        "pid": 1,
        "port": "text",
        "vendor": "text",
        "vid": 1,
        "active": true,
        "connected": true
      }
    ]
  }
}

Modify or create environment of an instance

put
Path parameters
instance_idstringRequired
Body
string[]Optional
Responses
200
Environment for instance with this instance id is set
201
Environment for instance with this instance id was created
400
Malformed request
application/json
404
No instance with this instance_id found
put
PUT /v2/instances/{instance_id}/config/environment HTTP/1.1
Host: localhost
Content-Type: application/json
Accept: */*
Content-Length: 8

[
  "text"
]

No content

Modify or create exposed ports of an instance

put
Path parameters
instance_idstringRequired
Body
string[]OptionalExample: ["8001:8001","5000","5001-5008:6001-6008","6001-6008"]
Responses
200
Exposed ports for instance with this instance id is set
201
Exposed ports for instance with this instance id was created
400
Malformed request
application/json
404
No instance with this instance_id found
put
PUT /v2/instances/{instance_id}/config/ports HTTP/1.1
Host: localhost
Content-Type: application/json
Accept: */*
Content-Length: 54

[
  "8001:8001",
  "5000",
  "5001-5008:6001-6008",
  "6001-6008"
]

No content