Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Cloudron API Docu - Set Operators correction?

    Discuss api documentation
    4
    1
    0 Votes
    4 Posts
    111 Views
    jamesJ
    Hello @3246 With the cloudron cli you can run e.g: cloudron exec --app $APP -- fallocate -l 4M /app/data/4M See cloudron exec --help: Usage: cloudron exec [options] [cmd...] Exec a command in an application Options: -t,--tty Allocate tty --app <id/location> App id or location -h, --help display help for command Examples: $ cloudron exec --app myapp # run an interactive shell $ cloudron exec --app myapp ls # run command $ cloudron exec --app myapp -- ls -l # use -- to indicate end of options Was not sure if possible via the API but since I can debug the cloudron cli and see what it do I figured something out. Send the to /api/v1/apps/$APPID/exec # Command is an array `ls -lah /app/data` would become for each space ["ls", "-lah", "/app/data/"] curl "https://my.$DOMAIN.$TLD/api/v1/apps/$APPID/exec" \ -H 'Authorization: Bearer $APITOKEN' \ -H 'content-type: application/json' \ --data-raw '["ls", "-lah", "/app/data/"]' # this returns and id { "id": "a90bcfcec1d29f7a595638ea66c8ac0bb53b594047ac74fc80bf97f75fed0c19" } But getting the output of the executed command is. . . tricky. Just look at the source code for the cli for this part: const searchParams = new URLSearchParams({ rows: stdout.rows || 24, columns: stdout.columns || 80, access_token: token, tty }); const req = https.request({ hostname: adminFqdn, path: `/api/v1/apps/${app.id}/exec/${execId}/start?${searchParams.toString()}`, method: 'GET', headers: { 'Connection': 'Upgrade', 'Upgrade': 'tcp' }, rejectUnauthorized }, function handler(res) { if (res.statusCode === 403) exit('Unauthorized.'); // only admin or only owner (for docker addon) exit('Could not upgrade connection to tcp. http status:', res.statusCode); }); req.on('upgrade', function (resThatShouldNotBeUsed, socket /*, upgradeHead*/) { // do not use res here! it's all socket from here on socket.on('error', exit); socket.setNoDelay(true); socket.setKeepAlive(true); if (tty) { stdin.setRawMode(true); stdin.pipe(socket, { end: false }); // the remote will close the connection socket.pipe(stdout); // in tty mode, stdout/stderr is merged socket.on('end', exitWithCode); // server closed the socket } else { // create stdin process on demand if (typeof stdin === 'function') stdin = stdin(); stdin.on('data', function (d) { var buf = Buffer.alloc(4); buf.writeUInt32BE(d.length, 0 /* offset */); socket.write(buf); socket.write(d); }); stdin.on('end', function () { var buf = Buffer.alloc(4); buf.writeUInt32BE(0, 0 /* offset */); socket.write(buf); }); stdout.on('close', exitWithCode); // this is only emitted when stdout is a file and not the terminal demuxStream(socket, stdout, process.stderr); // can get separate streams in non-tty mode socket.on('end', function () { // server closed the socket if (typeof stdin.end === 'function') stdin.end(); // required for this process to 'exit' cleanly. do not call exit() because writes may not have finished . the type check is required for when stdin: 'ignore' in execSync, not sure why if (stdout !== process.stdout) stdout.end(); // for push stream socket.end(); // process._getActiveHandles(); process._getActiveRequests(); if (stdout === process.stdout) setImmediate(exitWithCode); // otherwise, we rely on the 'close' event above }); } }); req.on('error', exit); // could not make a request req.end(); // this makes the request From a little debugging I got the API path: /api/v1/apps/$APPID/exec/$EXECID/start?rows=21&columns=257&tty=false But when CURL'ing this: curl "https://my.$DOMAIN.TLD/api/v1/apps/$APPID/exec/$EXECID/start?rows=21&columns=257&tty=false" \ -H "Authorization: Bearer $APITOKEN" \ -H 'content-type: application/json' { "status": "Not Found", "message": "exec requires TCP upgrade" } And I am not sure how to "TCP upgrade" the curl request. I will ask the team.
  • Nominatim (self hosted geocoding)

    App Wishlist api geolocation search geocoding
    1
    4 Votes
    1 Posts
    424 Views
    No one has replied
  • Accessing the OpenWebUI API

    OpenWebUI api openwebui
    12
    1 Votes
    12 Posts
    3k Views
    JOduMonTJ
    @nebulon understood; it's just in my testing environment (home) I'm use to connect my container via container_name:port without exposing the port. such as OpenWebUI connect to my Searxng because --- services: open-webui: searxng: container_name: searxng Now I understand this is not viable into a multi-domains, multi-services environment Do you think something similar is possible and viable ?
  • /api/v1/apps/install

    Solved Support api docs
    4
    0 Votes
    4 Posts
    875 Views
    nebulonN
    Finally got around to adding the docs for this route: https://docs.cloudron.io/api.html#tag/Apps/operation/installApp
  • GET GROUP truncated

    Solved Support api groups
    19
    0 Votes
    19 Posts
    4k Views
    D
    Thank you!
  • User import / Batch user creation

    Discuss api user management
    7
    1 Votes
    7 Posts
    2k Views
    necrevistonnezrN
    @BrutalBirdie That should be part of the docs!
  • Is it possible to clone an app via API?

    Discuss api
    2
    1 Votes
    2 Posts
    643 Views
    girishG
    @affinity yes, everything that you see in the UI has a corresponding API call. The dashboard is a pure frontend app. Unfortunately the docs for the API are lacking but we have someone working on this actively. For the moment, just look into the browser console for the API call it makes when cloning a application. Usually, it's a simple REST call. cc : @lassgutsein
  • User & Group CRUD API(S)

    Solved Support api docs
    3
    1 Votes
    3 Posts
    903 Views
    girishG
    @darren if you hit any issues, feel free to ask here.
  • Did the API urls change? Suddenly get 400 bad request errors

    Solved Support api
    3
    0 Votes
    3 Posts
    692 Views
    necrevistonnezrN
    Thanks for the hint - trying that I got a more meaningful error notice. It was one of the ipdeny urls (IPv6 list for North Korea) that resulted in an empty HTML file, throwing off the ipfile format.
  • /system/reboot no such route

    Solved Support api reboot
    6
    1
    1 Votes
    6 Posts
    2k Views
    LanhildL
    @girish Thanks, that was it.
  • Create mail accounts by API

    Solved Support api mail
    2
    0 Votes
    2 Posts
    658 Views
    BrutalBirdieB
    via api you can do that. POST {{baseUrl}}/mail/:domain/mailboxes note :domain is a variable for the mail domain. note {{baseUrl}} is the Cloudron api url e.g. https://my.DOMAIN.TLD/api/v1 with body: { "name": "webmaster", "ownerId": "uid-be9dcf57-ad65-40e0-a3f8-d1c75974bf01", "ownerType": "user" } The ownerType can be user or group. and the ownerId you need to get via either /users and for groups /groups. The API and the API Doc is currently being reworked. https://git.cloudron.io/cloudron/docs/-/blob/master/api/cloudron_api_swagger.yaml?ref_type=heads
  • certs_renew API no longer working?

    Solved Support reverseproxy api
    5
    0 Votes
    5 Posts
    1k Views
    potemkin_aiP
    Thanks, everyone!
  • POST /api/v1/cloudron/reboot 404

    Solved Support api
    7
    0 Votes
    7 Posts
    2k Views
    C
    Good to know it should work. I will try it again later. Can't reboot now in the middle of the day. Maybe something got cached in the browser then.
  • cloudron cli error

    Solved Support cli api
    11
    1
    0 Votes
    11 Posts
    3k Views
    girishG
    @webvsnet Ah alright Remember that when you upgrade Cloudron, you will have to get back to CLI 5.4.0
  • Issue with the API to change MemoryLimit

    Solved Support api
    5
    1
    0 Votes
    5 Posts
    1k Views
    A
    @girish said in Issue with the API to change MemoryLimit: --data-raw '{"memoryLimit":973078528} Thanks! this bit helped.
  • Rest API: Docu seems not correct for "Initial DNS Setup"

    Solved Support bug rest api setup
    3
    2 Votes
    3 Posts
    899 Views
    Q
    @girish thanks for pointing out to code. As always: In vino veritas - and in Source-Code
  • Call to API App install failing

    Solved Support api install
    5
    0 Votes
    5 Posts
    1k Views
    P
    @nebulon, @BrutalBirdie Thx to both of you, the call is now working. curl -kX POST -H "Content-Type: application/json" https://my.smthg.com/api/v1/apps/install?access_token=857f7d7eb583cfb951e5a50c75a762b94304d4ba50d4a0c94950643eaab7959a -d '{"appStoreId": "io.n8n.cloudronapp@2.37.0","subdomain": "workflow","domain": "somethg.com","accessRestriction": {"users":[],"groups":[]}}' { "id": "c6c79d78-7c7c-414b-acf7-8b5cc39370ed", "taskId": "269" } It needed obviously the header, but also I thought reading the API specs that accessRestriction could be null. It is not the case, so I used @BrutalBirdie assignment (empty users and groups) and the call succeeded. Once again thank you very much.
  • Rotation of AWS IAM credentials

    Solved Support aws route53 domains api
    12
    1 Votes
    12 Posts
    3k Views
    P
    Ignore me. This was an issue with PowerShell apparently. If run from linux it works fine. Thanks again
  • Failed to install app: 402 message: Missing token

    Solved Support api cli
    23
    0 Votes
    23 Posts
    6k Views
    A
    @girish well, that solved the problem i was facing, though i do not understand why it does, but anyway, thanks a lot that helped me Solved!! Solution = <Just sign in to the app store in your Cloudron Server as Mr. @girish said> Once more, thank you very much for the support .
  • Custom app install complains about subdomain

    Solved Support api cli
    4
    0 Votes
    4 Posts
    1k Views
    nebulonN
    Glad you managed to resolve this. Some ago we changed the REST api there which probably caused this issue when using an outdated cloudron cli tool.