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


    Cloudron Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular

    Solved A restAPI noob

    Support
    3
    7
    156
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      savity last edited by savity

      Hi there 🙂
      My goal is to install automaticly Cloudron if this works i would like to implement this to N8N.io

      curl -k -X POST -H 'Content-Type: application/json' --data '{
          "appStoreId": "com.nextcloud.cloudronapp",
          "location": "subdomain",
          "domain": "mycloudroninstanz.de",
          "accessRestriction": { },
          "portBindings": { },
          "icon": "string",
          "label": "MyAwesomeWebsite",
          "memoryLimit": 629145600,
          "sso": true,
          "enableBackup": true,
          "enableAutomaticUpdate": true,
          "alternateDomains": [ ],
          "overwriteDns": false
      }' https://mycloudroninstanz.de/api/v1/apps/install?access_token=MYACCESTOKEN
      

      According to this -> https://docs.cloudron.io/api.html#tag/Apps/paths/~1apps~1install/post i tried to creat a curl post and i am 100% this is wrong. Maybe someone could help me with this?

      Error:
      curl: (6) Could not resolve host: application
      curl: (3) URL using bad/illegal format or missing URL
      curl: (3) URL using bad/illegal format or missing URL
      curl: (3) URL using bad/illegal format or missing URL
      curl: (3) unmatched brace in URL position 1:
      {
      ^

      BrutalBirdie 1 Reply Last reply Reply Quote 0
      • BrutalBirdie
        BrutalBirdie Staff @BrutalBirdie last edited by BrutalBirdie

        With the noted quick hack with the network debugger I can give you this:

        curl 'https://my.DOMAIN.TLD/api/v1/apps/install' -X POST -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0' -H 'Accept: application/json, text/plain, */*' -H 'Accept-Language: en,en-US;q=0.7,de;q=0.3' -H 'Accept-Encoding: gzip, deflate, br' -H 'Referer: https://my.DOMAIN.TLD/' -H 'Authorization: Bearer REDACTED_TOKEN' -H 'Content-Type: application/json;charset=utf-8' -H 'Origin: https://my.DOMAIN.TLD' -H 'Connection: keep-alive' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: same-origin' -H 'TE: trailers' --data-raw '{"appStoreId":"com.nextcloud.cloudronapp@4.14.0","subdomain":"cloud","domain":"cloudron.dev","secondaryDomains":{},"portBindings":{},"accessRestriction":null,"cert":null,"key":null,"sso":true,"overwriteDns":false}'
        

        Now with some pretty json:

        {
        	"appStoreId": "com.nextcloud.cloudronapp@4.14.0",
        	"subdomain": "cloud",
        	"domain": "cloudron.dev",
        	"secondaryDomains": {},
        	"portBindings": {},
        	"accessRestriction": null,
        	"cert": null,
        	"key": null,
        	"sso": true,
        	"overwriteDns": false
        }
        

        There are some differences compared to your JSON Body.

        Diffs:

        • appStoreId also has the version
        • location from you and the on click send subdomain
        • accessRestriction from you is an empty JSON Array and mine is null

        Rest you can see for yourself 😉

        Like my work? Consider donating a beer 🍻 Cheers!

        1 Reply Last reply Reply Quote 2
        • BrutalBirdie
          BrutalBirdie Staff @savity last edited by

          @savity Please start using code block when pasting code.
          6df7cfce-31ed-4d8e-9953-14d226aa284a-grafik.png

          @savity said in A restAPI noob:

          My goal is to install automaticly Cloudron if this works i would like to implement this to N8N.io

          Do you want to install Cloudron automatically or do you wish to install Nextcloud automatically?

          Like my work? Consider donating a beer 🍻 Cheers!

          S 1 Reply Last reply Reply Quote 0
          • S
            savity @BrutalBirdie last edited by savity

            @BrutalBirdie I would like to use the APi request to deploy Nextcloud

            "appStoreId": "com.nextcloud.cloudronapp",

            BrutalBirdie 1 Reply Last reply Reply Quote 0
            • BrutalBirdie
              BrutalBirdie Staff @savity last edited by

              @savity have you seen this topic?
              https://forum.cloudron.io/topic/5840/unattended-install/16

              This might help you.

              Like my work? Consider donating a beer 🍻 Cheers!

              BrutalBirdie S 2 Replies Last reply Reply Quote 0
              • BrutalBirdie
                BrutalBirdie Staff @BrutalBirdie last edited by BrutalBirdie

                With the noted quick hack with the network debugger I can give you this:

                curl 'https://my.DOMAIN.TLD/api/v1/apps/install' -X POST -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0' -H 'Accept: application/json, text/plain, */*' -H 'Accept-Language: en,en-US;q=0.7,de;q=0.3' -H 'Accept-Encoding: gzip, deflate, br' -H 'Referer: https://my.DOMAIN.TLD/' -H 'Authorization: Bearer REDACTED_TOKEN' -H 'Content-Type: application/json;charset=utf-8' -H 'Origin: https://my.DOMAIN.TLD' -H 'Connection: keep-alive' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: same-origin' -H 'TE: trailers' --data-raw '{"appStoreId":"com.nextcloud.cloudronapp@4.14.0","subdomain":"cloud","domain":"cloudron.dev","secondaryDomains":{},"portBindings":{},"accessRestriction":null,"cert":null,"key":null,"sso":true,"overwriteDns":false}'
                

                Now with some pretty json:

                {
                	"appStoreId": "com.nextcloud.cloudronapp@4.14.0",
                	"subdomain": "cloud",
                	"domain": "cloudron.dev",
                	"secondaryDomains": {},
                	"portBindings": {},
                	"accessRestriction": null,
                	"cert": null,
                	"key": null,
                	"sso": true,
                	"overwriteDns": false
                }
                

                There are some differences compared to your JSON Body.

                Diffs:

                • appStoreId also has the version
                • location from you and the on click send subdomain
                • accessRestriction from you is an empty JSON Array and mine is null

                Rest you can see for yourself 😉

                Like my work? Consider donating a beer 🍻 Cheers!

                1 Reply Last reply Reply Quote 2
                • S
                  savity @BrutalBirdie last edited by

                  @BrutalBirdie Perfect that Topic helped. BR

                  1 Reply Last reply Reply Quote 1
                  • Topic has been marked as a question  girish girish 
                  • Topic has been marked as solved  girish girish 
                  • girish
                    girish Staff last edited by

                    If you keep your browser devtools open and install an app, you can copy the network command as "curl" command. For example, if you install app, just look for the "install" POST call.

                    9ff9a963-7e36-42ea-b4ec-b4070f1046a1-image.png

                    1 Reply Last reply Reply Quote 1
                    • First post
                      Last post
                    Powered by NodeBB