Google Cloud Endpoints .api file not generated - google-app-engine

I am using GAE/J to create Google Could Endpoints using #Api and #ApiMethod annotations.
I successfully created an API and was able to test and view it on APIs Explorer but the <appname>-v1.api file is no more generated after I added one more method to the Api class.
I tried removing the new method to check if that was a problem, but even with just the old methods, the .api is not getting generated.

Related

How to make a deployed react app (in s3) consume JSON data which is dropped in an s3 bucket?

I am trying to build a static React App which displays api documentation. For backend I am using swagger (hosted separately in a lambda) which generates the JSON data model. With new endpoints created, I have a lambda which will give me the details of the endpoint, like headers, requests and response. The data comes in format of JSON which is dropped in a s3 bucket. Could my react app deployed in the same bucket, consume that json and render the newly added api documentation details? I need help on the same without a node backend?
Here is an example of what I am trying to build
A react app with cooking receipies is deployed statically hosted in s3.
The receipies for this app is in JSON model, which is common for any up comming receipies
This app is in AWS s3 bucket.
A new recepie needs to be added to my app. But my app is already built and hosted.
Can I build my app in such a way that if I drop any new JSON files, it would consume that file and render/refresh its frontend, without a server in S3?
Given that your app is statically hosted in S3, you will have to write client-side JS code to check for the new recipes.
You can call your Lambda from the client-side to get the endpoint and send a request to get all the recipes. If the folder path in S3 is known, you can do this check without needing the Lambda.
This way, your app will refresh the frontend without a server when you add a new JSON file.
After some through research I found that, you could drop all your JSON files in Public folder in React App. The files in this folder will not be altered. So you could access them in your react component with react useEffect Hook. Here is the reference article I took this implementation from.
How to add Static JSON files in React App post deployment

Google cloud endpoints service is not listed in api library

I'm trying to share my API (with a custom domain) with the customer( service consumer role), but this API is not listed in the API library. When he tries to open API using the link to generate API key he gots errors. The same problem I have when I try to generate API key for customers. I'm using endpoints frameworks for the GAE standard environment. Image
This one looks more like a problem with the Cloud console or the Cloud APIs, I'd better address the issue at a Public Issue Tracker (PIT), you can open one in here, and preferably add a relevant HAR file that should contain some additional information of the response message.
This will help to correctly address any ongoing service issue.

How to upload image to Google Cloud Storage with GAE/Cloud Endpoints API method

Does anyone have an example of a GAE/Cloud Endpoints API method (in Java) that can take in an image from an Android app and upload it to Google Cloud Storage?
I cannot seem to find any samples on how to do this but it is possible from what I understand.
EDIT:
The tutorial here shows how to add a dependency to google app engine in eclipse and upload/download an image to Google Cloud Storage. Is it possible to do this with Cloud Endpoints somehow..? After all, they are both Google App Engine.
I want to offload as much of the upload/download code into my Cloud Endpoints API method(s), rather than coding everything inside of Android. This would allow me to reuse my Cloud Endpoints API on other clients.
More info I found: https://developers.google.com/api-client-library/java/apis/storage/v1#sample
Looks like this is the gradle dependency for the cloud endpoints backend?:
dependencies {
compile 'com.google.apis:google-api-services-storage:v1-rev66-1.21.0'
}
EDIT:
You should use this dependency inside cloud endpoints:
compile 'com.google.appengine.tools:appengine-gcs-client:0.5'
You can upload file to Google Storage using Json Api
You may or may not want to store file metadata to datastore thru Endpoints.
You may or may not want to authenticate your users thru Endpoints before give them possibility to store files to Storage.
What I want to say is that Storage / Endpoints / Datastore are three different things and you don't required to use them all together.
Useful link: https://github.com/pliablematter/simple-cloud-storage
You cannot directly upload (large) files to an Endpoints API method but instead need to receive them using the blobstore (or GCS) (https://cloud.google.com/appengine/docs/python/blobstore/ ). This requires the following:
Setup on your server a blobstore upload handler (which is just a regular webapp2 handler).
Expose an Endpoints method that calls blobstore.create_upload_url(), and then returns the upload URL to your App.
Within the App, upload the picture to that upload URL; the file will then be accessible within your upload handler, where you can move it to GCS, Datastore or somewhere else.
Solution : https://github.com/thorrism/GoogleCloudExample
Enable Google Cloud Storage : => https://console.developers.google.com/apis
Generate and download a key P12 : => https://console.developers.google.com/iam-admin/iam
Create a folder named "assets" and place there your key :
=> app/src/main/assets/"yourKey.P12"
For everyone can access your uploaded file reading do not forget to add the permissions on your Bucket

Disable API discovery for API Explorer

I'm new to App Engine and am trying to figure out how to disable the API Explorer from showing all my APIs, which are currently public and available to anyone visiting [MYPROJECT].appspot.com/_ah/api/explorer
Supposedly Snapchat uses AppEngine, however visiting https://apis-explorer.appspot.com/apis-explorer/?base=https://feelinsonice.appspot.com/_ah/api#p/ does not reveal their APIs.
Viewing network activity for that page you'll see that requests are being made to https://feelinsonice.appspot.com/_ah/api/discovery/v1/apis but returning a 404.
How do I do the same?
When visiting the API Explorer using my project ID I see this:
Is this the culprit?
Endpoints is the 'culprit'. I'm assuming you are using endpoints since you've included that tag, and I guess snapchat doesn't use endpoints.
There is nothing you can do to change this other then stop using endpoints.

Generating Endpoints class from objectify

As stated in the title, is there a way of doing this using Google Plugin for eclipse?
I tried to generate it using Generate Cloud Endpoints class in GPE, I got this error in appengine log:
org.datanucleus.metadata.MetaDataManager loadPersistenceUnit: Class com.UserDataEndpoint was specified in persistence-unit transactions-optional but not annotated, so ignoring
All the classes I generate using "Generate Cloud Endpoints class" have this error, and can't do any transactions in the API Explorer.
I read in other thread of Stackoverflow, but there is no clear guide on doing this correctly, so I opened a new thread.
Thank you
EDIT : I forgot to mention that I'm using GPE App Engine Connected Android Project wizard to deal with Objectify 5

Resources