From bf4fe911973acf4a3372423d8c90bd3f7a6fbfe8 Mon Sep 17 00:00:00 2001
From: jfefe <jfefe@aternatik.fr>
Date: Thu, 17 Sep 2015 20:48:57 +0200
Subject: [PATCH] FIX #3548 : API not working after removing Composer

---
 htdocs/api/restler.php      | 8 ++++++++
 htdocs/public/api/index.php | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)
 create mode 100644 htdocs/api/restler.php

diff --git a/htdocs/api/restler.php b/htdocs/api/restler.php
new file mode 100644
index 00000000000..ae891386b31
--- /dev/null
+++ b/htdocs/api/restler.php
@@ -0,0 +1,8 @@
+<?php
+// use the restler auto loader
+require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/AutoLoader.php';
+return call_user_func(function () {
+    $loader = Luracast\Restler\AutoLoader::instance();
+    spl_autoload_register($loader);
+    return $loader;
+});
\ No newline at end of file
diff --git a/htdocs/public/api/index.php b/htdocs/public/api/index.php
index 24bd3715726..ae8e977bf74 100644
--- a/htdocs/public/api/index.php
+++ b/htdocs/public/api/index.php
@@ -31,7 +31,7 @@ $res=0;
 if (! $res && file_exists("../../main.inc.php")) $res=include '../../main.inc.php';
 if (! $res) die("Include of main fails");
 
-require_once DOL_DOCUMENT_ROOT.'/includes/autoload.php';
+require_once DOL_DOCUMENT_ROOT.'/api/restler.php';
 require_once DOL_DOCUMENT_ROOT.'/api/class/api.class.php';
 require_once DOL_DOCUMENT_ROOT.'/api/class/api_access.class.php';
 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
-- 
GitLab