1

I am facing a problem in endpoint. I am using google app engine on local machine. I am trying to make a endpoint api. The api is created successfully but when i open explorer and select my api give some parameters to it. It does not return response. In response it said 404 not found

Here is the code:

api.py

import endpoints
import protorpc

from ModelClasses import test


import main

@endpoints.api(name="test",version="v1",description="testingapi",hostname="login-test-1208.appspot.com")
class testapi(protorpc.remote.Service):



    @test.method(name="userinsert",path="userinsert",http_method="POST")
    def userinsert(self,request):

        qr = test()
        qr.user = request.user
        qr.passw = request.passw

        qr.put()
        return qr


app = endpoints.api_server([testapi],restricted=False)

ModelClasses.py

from endpoints_proto_datastore.ndb import EndpointsModel
from google.appengine.ext import ndb



class test(EndpointsModel):

    user = ndb.StringProperty(required=True)
    passw = ndb.StringProperty(required=True)

app.yaml

application: ID
version: 1
runtime: python27
api_version: 1
threadsafe: yes

handlers:
- url: /favicon\.ico
  static_files: favicon.ico
  upload: favicon\.ico


- url: /static
  static_dir: static

- url: /stylesheets
  static_dir: stylesheets

- url: /(.*\.js)
  mime_type: text/javascript
  static_files: static/\1
  upload: static/(.*\.js)


- url: /_ah/spi/.*
  script: api.app

libraries:
- name: webapp2
  version: latest
- name: jinja2
  version: latest

- name: endpoints
  version: latest

- name: pycrypto
  version: 1.0

enter image description here

enter image description here

You can see the request and response in pictures.

Any help would be appreciated.

4
  • Just to clarify: are you testing the API running on localhost or have you deployed the API to App Engine already? If running on localhost you should remove the hostname parameter which is optional anyway, to make sure the requests are actually sent to localhost. Commented Jul 25, 2016 at 14:21
  • Thank you for your response i am running it on localhost. Commented Jul 25, 2016 at 14:22
  • It is giving me response now. But it is saying "503 Service Unavailable". Commented Jul 25, 2016 at 14:27
  • I figured out my problem and now it is working fine thank you :) Commented Jul 25, 2016 at 14:43

1 Answer 1

1

@Scarygami Answere is correct. I have to remove the hostname because i am using it on local host.

Sign up to request clarification or add additional context in comments.

1 Comment

I don't believe you should ever need hostname anymore anyway.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.