diff --git a/htdocs/api/admin/explorer.php b/htdocs/api/admin/explorer.php
index 44a14f99675..66d06e91679 100644
--- a/htdocs/api/admin/explorer.php
+++ b/htdocs/api/admin/explorer.php
@@ -150,12 +150,30 @@ $linkback=''.$langs->trans("BackToM
print load_fiche_titre($langs->trans("ApiSetup"),$linkback,'title_setup');
+// Define $urlwithroot
+$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
+$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
+//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
+
+// Show message
+print '
';
+$message='';
+$url=''.$urlwithroot.'/api/index.php/login?login='.urlencode($user->login).'&password=yourpassword';
+$message.=$langs->trans("UrlToGetKeyToUseAPIs").':
';
+$message.=img_picto('','object_globe.png').' '.$url;
+print $message;
+print '
';
+print '
';
+
+print $langs->trans("ListOfAvailableAPIs").':
';
foreach($listofapis['v1'] as $key => $val)
{
+ if ($key == 'login') continue;
if ($key)
{
//print $key.' - '.$val['classname'].' - '.$val['fullpath']." - ".DOL_MAIN_URL_ROOT.'/api/index.php/'.strtolower(preg_replace('/Api$/','',$val['classname']))."/xxx
\n";
- $url=DOL_MAIN_URL_ROOT.'/api/index.php/'.$key;
+ $url=$urlwithroot.'/api/index.php/'.$key;
+ $url.='?api_key=token';
print img_picto('','object_globe.png').' '.$url."
\n";
}
diff --git a/htdocs/api/index.php b/htdocs/api/index.php
index d7bcedb5fd7..55a45aea4b9 100644
--- a/htdocs/api/index.php
+++ b/htdocs/api/index.php
@@ -141,6 +141,8 @@ foreach ($modulesdir as $dir)
// TODO If not found, redirect to explorer
+
+// Call API (we suppose we found it)
$api->r->handle();
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index b37083ca091..7b13a4ec5b5 100755
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1740,3 +1740,5 @@ AddOtherPagesOrServices=Add other pages or services
AddModels=Add document or numbering templates
AddSubstitutions=Add keys substitutions
DetectionNotPossible=Detection not possible
+UrlToGetKeyToUseAPIs=Url to get token to use API (once token has been received it is saved on database user table and will be checked on each future access)
+ListOfAvailableAPIs=List of available APIs
\ No newline at end of file