diff --git a/pages/02.administer/60.extend/15.theming/theming.fr.md b/pages/02.administer/45.tutorials/10.theming/theming.fr.md similarity index 100% rename from pages/02.administer/60.extend/15.theming/theming.fr.md rename to pages/02.administer/45.tutorials/10.theming/theming.fr.md diff --git a/pages/02.administer/60.extend/15.theming/theming.md b/pages/02.administer/45.tutorials/10.theming/theming.md similarity index 100% rename from pages/02.administer/60.extend/15.theming/theming.md rename to pages/02.administer/45.tutorials/10.theming/theming.md diff --git a/pages/02.administer/60.extend/25.hooks/hooks.md b/pages/02.administer/60.extend/25.hooks/hooks.md deleted file mode 100644 index 5be0ac0f..00000000 --- a/pages/02.administer/60.extend/25.hooks/hooks.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Hooks -template: docs -redirect: '/packaging_apps_hooks' ---- diff --git a/pages/02.administer/60.extend/30.api/admin_api.fr.md b/pages/02.administer/60.extend/30.api/admin_api.fr.md deleted file mode 100644 index 291b2b3a..00000000 --- a/pages/02.administer/60.extend/30.api/admin_api.fr.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -title: Administration depuis l'API ou une application externe -template: docs -taxonomy: - category: docs -routes: - default: '/admin_api' ---- - -Toutes les actions exécutables en ligne de commande le sont également via une API. L’API est accessible à l’adresse . -Pour le moment, il n'existe pas de documentation des différentes routes... mais vous pouvez trouver l'actionmap [ici](https://github.com/YunoHost/yunohost/blob/dev/share/actionsmap.yml) (en particulier les clefs `api`) - -## Avec cURL - -Il faut d’abord récupérer un cookie de connexion pour ensuite réaliser les actions. Voici un exemple avec cURL : - -```bash -# Login (avec mot de passe admin) -curl -k -H "X-Requested-With: customscript" \ - -d "password=supersecretpassword" \ - -dump-header headers \ - https://your.server/yunohost/api/login - -# Exemple de GET -curl -k -i -H "Accept: application/json" \ - -H "Content-Type: application/json" \ - -L -b headers -X GET https://your.server/yunohost/api/ROUTE \ - | grep } | python -mjson.tool -``` - -## Avec une classe PHP - -Pour simplifier l’administration à distance d’une instance YunoHost dans le cadre d’un projet CHATONS/Librehosters, des classes API ont été développées par des utilisateurs. - -Par exemple, cette [classe PHP](https://github.com/scith/yunohost-api-php) vous permettra d’administrer votre instance YunoHost depuis une application PHP (site Web, outil de gestion de capacité...). - -Voici un exemple de code PHP permettant d’ajouter un utilisateur dans votre instance YunoHost : - -```php -require("ynh_api.class.php"); -$ynh = new YNH_API("adresse IP du serveur YunoHost ou nom d’hôte", "mot de passe administrateur"); - -if ($ynh->login()) { - $domains = $ynh->get("/domains"); - $first_domain = $domains['domains'][0]; - - $arguments = array( - 'username' => 'test', - 'password' => 'yunohost', - 'firstname' => 'Prénom', - 'lastname' => 'Nom', - 'mail' => 'test@'.$first_domain, - 'mailbox_quota' => '500M' - ); - - $user_add = $ynh->post("/users", $arguments); - print_r($user_add); - -} else { - print("Login to YunoHost failed.\n"); - exit; -} -``` diff --git a/pages/02.administer/60.extend/30.api/admin_api.md b/pages/02.administer/60.extend/30.api/admin_api.md deleted file mode 100644 index fd49c76e..00000000 --- a/pages/02.administer/60.extend/30.api/admin_api.md +++ /dev/null @@ -1,67 +0,0 @@ ---- -title: Administration from the API or an external application -template: docs -taxonomy: - category: docs -routes: - default: '/admin_api' ---- - -All command line actions can also be ran from the web API. The API is available at . - -## Test with curl - -You must first retrieve a login cookie thanks to the /login route to perform the other actions. - -```bash -# Login (with admin password) -curl -k -H "X-Requested-With: customscript" \ - -d "credentials=supersecretpassword" \ - -dump-header headers \ - https://your.server/yunohost/api/login - -# GET example -curl -k -i -H "Accept: application/json" \ - -H "Content-Type: application/json" \ - -H 'Cookie: yunohost.admin="XXXXXXXX"' \ - -L -b headers -X GET https://your.server/yunohost/api/ROUTE \ - | grep } | python -mjson.tool -``` - -## Test with our swagger doc - - 1. Login on the [Webadmin of `demo.yunohost.org`](https://demo.yunohost.org/yunohost/admin/) - 2. Use the `Try it out` button on the API endpoint you want to test - -
- - - - - - diff --git a/pages/02.administer/60.extend/extend.md b/pages/02.administer/60.extend/extend.md deleted file mode 100644 index 6a7d9ccc..00000000 --- a/pages/02.administer/60.extend/extend.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -title: Understand and extend YunoHost -template: docs -taxonomy: - category: docs -routes: - default: '/extend' ---- - -!! This section is to be written