GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — java-docs-samples/appengine-java8/endpoints-v2-backend at master · foreverimps/java-docs-samples

Expand file tree

/

endpoints-v2-backend

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
 
 
/

endpoints-v2-backend

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
src/main
src/main
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
pom.xml
pom.xml
 
 

README.md

Outline

App Engine Standard & Google Cloud Endpoints Frameworks & Java

This sample demonstrates how to use Google Cloud Endpoints Frameworks using Java on App Engine Standard.

Adding the project ID to the sample API code

You must add the project ID obtained when you created your project to the sample's pom.xml before you can deploy the code.

To add the project ID:

  1. Edit the file pom.xml.

  2. For <endpoints.project.id>, replace the value YOUR_PROJECT_ID with your project ID.

  3. Edit the file src/main/java/com/example/echo/Echo.java.

  4. Replace the value YOUR-PROJECT-ID with your project ID.

  5. Save your changes.

Building the sample project

To build the project:

mvn clean package

Generating the openapi.json file

To generate the required configuration file openapi.json:

mvn exec:java -DGetSwaggerDoc

Deploying the sample API to App Engine

To deploy the sample API:

  1. Invoke the gcloud command to deploy the API configuration file:

      gcloud service-management deploy openapi.json
    
  2. Deploy the API implementation code by invoking:

      mvn appengine:deploy
    

    The first time you upload a sample app, you may be prompted to authorize the deployment. Follow the prompts: when you are presented with a browser window containing a code, copy it to the terminal window.

  3. Wait for the upload to finish.

Sending a request to the sample API

After you deploy the API and its configuration file, you can send requests to the API.

To send a request to the API, from a command line, invoke the following cURL command:

 curl \
     -H "Content-Type: application/json" \
     -X POST \
     -d '{"message":"echo"}' \
     https://$PROJECT_ID.appspot.com/_ah/api/echo/v1/echo

You will get a 200 response with the following data:

{
 "message": "echo"
}
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.