Skip to content
This repository has been archived by the owner on Jun 9, 2019. It is now read-only.

localhost/resources not showing any API's #14

Open
MichaelCPGordon opened this issue Dec 14, 2014 · 2 comments
Open

localhost/resources not showing any API's #14

MichaelCPGordon opened this issue Dec 14, 2014 · 2 comments

Comments

@MichaelCPGordon
Copy link

Hi there,

I'm having trouble getting the API explorer to work correctly with my restler API's.

When I go to localhost/explorer, I get the API Explorer header bar at the top of the page and below I get text saying "fetching resource list: ../resources.json" but nothing else.

When I go to localhost/resources, the page returns the following:

{
    "apiVersion": "1",
    "swaggerVersion": "1.1",
    "basePath": "http://localhost",
    "produces": [
        "application/json"
    ],
    "consumes": [
        "application/json"
    ],
    "apis": [

    ]
}

So I'm guessing that it's setting up the resources.json file but doesn't seem to acknowledge that my API's exist?

Here's my index.php file:

<?php
use Luracast\Restler\Restler;
require_once '../vendor/restler.php';

$r = new Restler();

$r->addAPIClass('Resources');
$r->addAPIClass('Employee', 'employees');

$r->addAuthenticationClass('BasicAuth');
$r->handle();

I've also tried testing this with another restler project which had a multiple API's and I have the same issue. Anything obvious that I'm missing?

@MichaelCPGordon MichaelCPGordon changed the title lolcalhost/resources not showing any API's localhost/resources not showing any API's Dec 14, 2014
@WebKudu
Copy link

WebKudu commented Jul 13, 2015

I'm having this exact same issue. Have spent a ton of time trying to figure it out and getting nowhere. For what it's worth, Example 008 Documentation does work on my machine. Here's the contents of my index.php:

<?php // Entry point for all API requests 
require_once($_SERVER["DOCUMENT_ROOT"]."/environment/start.php");

require_once 'restler/vendor/restler.php';
use Luracast\Restler\Restler;

$restler = new Restler();

$restler->addAPIClass('ApiContact');
$restler->addAPIClass('ApiLogin');
$restler->addAPIClass('ApiRequests');
$restler->addAPIClass('ApiSubjects');
$restler->addAPIClass('Luracast\\Restler\\Resources');          // this creates resources.json at API Root

$restler->addAuthenticationClass('AccessControl');

$restler->handle(); //serve the response

@WebKudu
Copy link

WebKudu commented Jul 14, 2015

I've resolved my problem with the line
Luracast\Restler\Resources::$hideProtected = false;

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants