Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot access API explorer on localhost

I'm trying to build an Endpoints application, but am new to Google App Engine.

As I understand it, there's some kind of API Explorer included in the SDK that should let me test/verify my API -- the docs say: "Test the API backend in the Google APIs Explorer by navigating to http://localhost:8080/_ah/api/explorer". But I can't find any documentation of what API Explorer actually is, does, or looks like.

In any case, when I try to hit that URL, I get immediately redirected to https://developers.google.com/apis-explorer/?base=http://localhost:8080/_ah/api#p/, which tells me nothing useful, and seems like it must be an error of some kind.

The devappserver logs say:

INFO     2013-07-17 17:27:54,574 server.py:593] default: "GET /_ah/api/explorer HTTP/1.1" 302 -
INFO     2013-07-17 17:27:56,099 server.py:593] default: "GET /_ah/api/static/proxy.html?jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.en.7JUwNUXMAS8.O%2Fm%3D__features__%2Fam%3DEQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAItRSTO0dpKS_pssf5r3z87E6FlFvDGdOg HTTP/1.1" 200 1933
INFO     2013-07-17 17:27:56,193 server.py:593] default: "POST /_ah/spi/BackendService.getApiConfigs HTTP/1.1" 200 2342
INFO     2013-07-17 17:27:56,492 server.py:593] default: "GET /_ah/api/discovery/v1/apis HTTP/1.1" 200 576
INFO     2013-07-17 17:27:56,507 server.py:593] default: "POST /_ah/spi/BackendService.getApiConfigs HTTP/1.1" 200 2342
INFO     2013-07-17 17:27:56,583 server.py:593] default: "POST /_ah/spi/BackendService.getApiConfigs HTTP/1.1" 200 2342
INFO     2013-07-17 17:27:56,811 server.py:593] default: "GET /_ah/api/discovery/v1/apis HTTP/1.1" 200 576
INFO     2013-07-17 17:27:56,886 server.py:593] default: "GET /_ah/api/discovery/v1/apis/scrnxSync/v1/rest HTTP/1.1" 200 3365

for whatever that's worth.

Here's my app.yaml:

application: scrnx-cloud-1
version: 1
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /admin/.*
  script: admin.application
  login: admin
  secure: always

  # Endpoints handler
- url: /_ah/spi/.*
  script: sync_api.application

  # catchall - must come last    
- url: /.*
  script: default.application


admin_console:
  pages:
  - name: View Measurement
    url: /admin/measurement  


libraries:
- name: jinja2
  version: 2.6
- name: markupsafe
  version: 0.15

builtins:
- admin_redirect: off
- appstats: off
- deferred: off
- remote_api: on

Is there something else I'm supposed to be doing to set this up?

like image 354
c roald Avatar asked Jul 17 '13 17:07

c roald


4 Answers

Something changed, and now you must start Chrome in a specific way to use api explorer on localhost development server

here is a link to info from google.

But for me it still didn't fix using api explorer with localhost dev server.
I find that a possible workaround is to launch Chrome with the flag "--allow-running-insecure-content"
On MacOs in terminal run this:

/Applications/Google\ Chrome.app/Contents/Mac/Google\ Chrome --user-data-dir=test --allow-running-insecure-content

like image 55
Przemek Lada Avatar answered Nov 19 '22 08:11

Przemek Lada


If you are using Chrome browser, just make https in the URL to http. It worked for me.

http://apis-explorer.appspot.com/apis-explorer/?base=http://localhost:8080/_ah/api#p/

like image 37
A Paracha Avatar answered Nov 19 '22 09:11

A Paracha


The URL for the API Explorer is correct, but there have been some issues (apparently not all resolved) where the API Explorer doesn't correctly list your APIs.

As comparison of how it should look like https://developers.google.com/apis-explorer/ is the API Explorer for Google APIs, far more APIs than you would normally host yourself, but just to give you an idea of what you should see: a list of APIs and details for each API once you click on it.

A workaround that usually worked is to explicitly add the name and version of your API to the URL, so since your API is called scrnxSync with version v1 this link should show you the methods you defined for your API, and allow you to call those methods:

https://developers.google.com/apis-explorer/?base=http://localhost:8080/_ah/api#p/scrnxSync/v1/

like image 4
Scarygami Avatar answered Nov 19 '22 08:11

Scarygami


I tried all of the above in chrome and nothing works for me, but using firefox I just click in the lock at the left of the url bar and disable the security. That made the trick for me, cheers !! :D

like image 4
Andrés Muñoz Avatar answered Nov 19 '22 08:11

Andrés Muñoz