Re: 404 not found when calling specific service API

755 views
Skip to first unread message
Message has been deleted

Ki Sung Bae

unread,
Jan 11, 2017, 7:42:10 PM1/11/17
to Google App Engine
I'm not sure about this but APIs directory of default service supposed to show all api in every services of same project. Please correct me if i'm thinking wrong.

https://weneepl-appbuilder.appspot.com/_ah/api/discovery/v1/apis

this apis directory of default service shows only echo api with missing echo2.
Is this a bug?

2017년 1월 11일 수요일 오후 11시 6분 22초 UTC+9, Ki Sung Bae 님의 말:

Hi, I have deployed 2 api to different services in same google cloud project.

one is echo api which is default service.

the other is echo2 api with echo2-api service name

and here is my html source to call echo2-api from javascript. See this link https://storage.googleapis.com/wnptempstorage/test.html 

<html>
 <head>
   <script src="https://apis.google.com/js/api.js"></script>
   <script>
     function start() {
       // Initializes the client with the API key and the Translate API.
       gapi.client.init({
         'discoveryDocs': ['https://echo2-api-dot-weneepl-appbuilder.appspot.com/_ah/api/discovery/v1/apis/echo2/v1/rest']
       }).then(function() {
         // Executes an API request, and returns a Promise.
         // The method name `language.translations.list` comes from the API discovery.
         console.log(gapi.client);
         gapi.client.echo2.echo('hello world').execute((resp) => {
             console.log(resp);
         });
       });
     };

      // Loads the JavaScript client library and invokes `start` afterwards.
     gapi.load('client', start);
   </script>
 </head>
 <body>
   <div id="results"></div>
 </body>
</html>


Problem is that it requests url without service specified for echo2-api and the result is 404 not found.

Did I make a mistake to call echo2-api from javascript? 


FYI,
echo1
app.yaml : https://storage.googleapis.com/wnptempstorage/echo/app.yaml
echov1openapi.json : https://storage.googleapis.com/wnptempstorage/echo/echov1openapi.json

echo2
app.yaml: https://storage.googleapis.com/wnptempstorage/echo2/app.yaml
echo2v1openapi.json : https://storage.googleapis.com/wnptempstorage/echo2/echo2v1openapi.json


Thank you in advance

Nicholas (Google Cloud Support)

unread,
Jan 12, 2017, 12:46:22 PM1/12/17
to Google App Engine
Hey Ki Sung Bae,

Thanks for providing the files linked above.  Do I understand correctly that you are trying to deploy 2 different APIs to two different App Engine services to the same domain?  Which guide are you following to do this?  Are you using App Engine standard or flexible?  What behavior are you expecting exactly with the API discovery docs provided through Javascript?

I apologize for the questions but I'm having difficulty understanding how the behavior you're seeing differs from your expectations or from the documented behavior.  Any additional details would be helpful.

Ki Sung Bae

unread,
Jan 15, 2017, 10:47:23 PM1/15/17
to google-a...@googlegroups.com
Yes, that's right. I'm trying to deploy 2 different APIs to 2 different App Engine services in one single google cloud project.  In Detail, what I want to try is building multiple endpoints APIs as microservices. (link : https://cloud.google.com/appengine/docs/python/microservices-on-app-engine ) I'm using Appengine Standard. 

Let's assume that I have 2 sets of API. (EchoAPI, HelloWorldAPI). My goal is having 2 appengine services. (echoapi service, helloworldapi service). So I did following.

1. Deployed EchoAPI to EchoAPI appengine service by adding "service: echoapi" in app.yaml
2. Deployed HelloWorldAPI to HelloWorldAPI appengine service by adding "service: helloworldapi" in app.yaml
3. In javascript client, I want to call HelloWorldAPI. So I've added discovery url for helloworldapi of which url starts with 'https://helloworldapi-dot-myprojectid.appspot.com/_ah/api/discovery/'.
4. And API calls of javascript are sent to 'https://myprojectid.appspot.com/_ah/api/discovery/' and it return 404 not found. Because there's no API deployed to default service.

What I was expecting is calling from ''https://helloworldapi-dot-myprojectid.appspot.com' and get some results.

2017년 1월 13일 (금) 오전 2:46, 'Nicholas (Google Cloud Support)' via Google App Engine <google-a...@googlegroups.com>님이 작성:
--
You received this message because you are subscribed to a topic in the Google Groups "Google App Engine" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-appengine/HmZakj95Jz8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/ea180c72-37cf-46df-9629-2f2080cdc241%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Adam (Cloud Platform Support)

unread,
Feb 5, 2017, 4:19:18 PM2/5/17
to google-a...@googlegroups.com
It sounds like you only have enabled one of the service configurations. Before even getting into any code, you should see if both APIs are actually serving, for example using the API Explorer links:


You can see that the same API is being advertised by the discovery service (echo API v1) regardless of which service you hit. I'm assuming you've done the following to deploy your OpenAPI JSON configs for each API:

gcloud service-management deploy echov1openapi.json
gcloud service-management deploy echov2openapi.json

To list the deployed service configs, run:

To list which services are actually enabled:
gcloud service-management list

If you see that only one service is enabled, you can enabled the other one with:

On Sunday, January 15, 2017 at 10:47:23 PM UTC-5, Ki Sung Bae wrote:
Yes, that's right. I'm trying to deploy 2 different APIs to 2 different App Engine services in one single google cloud project.  In Detail, what I want to try is building multiple endpoints APIs as microservices. (link : https://cloud.google.com/appengine/docs/python/microservices-on-app-engine ) I'm using Appengine Standard. 

Let's assume that I have 2 sets of API. (EchoAPI, HelloWorldAPI). My goal is having 2 appengine services. (echoapi service, helloworldapi service). So I did following.

1. Deployed EchoAPI to EchoAPI appengine service by adding "service: echoapi" in app.yaml
2. Deployed HelloWorldAPI to HelloWorldAPI appengine service by adding "service: helloworldapi" in app.yaml
3. In javascript client, I want to call HelloWorldAPI. So I've added discovery url for helloworldapi of which url starts with 'https://helloworldapi-dot-myprojectid.appspot.com/_ah/api/discovery/'.
4. And API calls of javascript are sent to 'https://myprojectid.appspot.com/_ah/api/discovery/' and it return 404 not found. Because there's no API deployed to default service.

What I was expecting is calling from ''https://helloworldapi-dot-myprojectid.appspot.com' and get some results.

2017년 1월 13일 (금) 오전 2:46, 'Nicholas (Google Cloud Support)' via Google App Engine <google-appengine@googlegroups.com>님이 작성:
To unsubscribe from this group and all its topics, send an email to google-appengine+unsubscribe@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages