A restAPI noob
-
Hi there
My goal is to install automaticly Cloudron if this works i would like to implement this to N8N.iocurl -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:
{
^ -
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 versionlocation
from you and the on click sendsubdomain
accessRestriction
from you is an empty JSON Array and mine isnull
Rest you can see for yourself
-
@savity Please start using code block when pasting code.
@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?
-
@BrutalBirdie I would like to use the APi request to deploy Nextcloud
"appStoreId": "com.nextcloud.cloudronapp",
-
@savity have you seen this topic?
https://forum.cloudron.io/topic/5840/unattended-install/16This might help you.
-
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 versionlocation
from you and the on click sendsubdomain
accessRestriction
from you is an empty JSON Array and mine isnull
Rest you can see for yourself
-
@BrutalBirdie Perfect that Topic helped. BR
-
-
-
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.