A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://cloud.google.com/api-gateway/docs/passing-data below:

Passing data to and from the backend service | API Gateway Documentation

Stay organized with collections Save and categorize content based on your preferences.

Passing data to and from the backend service

When an API client makes a request to your API deployed on API Gateway, the client can pass any or all of the following information as part of the request:

In building its response to the API request, the backend service can return data to the API client, including:

This document describes how this data is passed to and from the backend service.

How is request data passed to the backend service?

All data in the request from the API client is passed unchanged to the backend service. It is then up to the backend service to parse the request data as part of handling the request.

How is response data returned to the API client?

All data received in the response from the backend service is passed unchanged to the API client. It is then up to the API client to process any returned data in the response.

How is the request URL passed to the backend service?

The URL used to make a request to the backend service is controlled by the x-google-backend extension. This section describes the options for configuring the backend service URL.

Setting the backend service address and path in the OpenAPI spec

In the OpenAPI spec that you use to create an API config, you use the x-google-backend extension to specify the URL of the backend service. For example, you specify the backend service in the form:

Backend x-google-backend Cloud Run functions
x-google-backend:
  address: https://GCP_REGION-PROJECT_ID.cloudfunctions.net/hello
Cloud Run
x-google-backend:
  address: https://hello-HASH.a.run.app
App Engine standard environment
x-google-backend:
  address: https://PROJECT_ID.appspot.com

In these examples:

  1. GCP_REGION specifies the Google Cloud region for the deployed backend.
  2. PROJECT_ID specifies the Google Cloud project ID.
  3. HASH specifies the unique hash code generated when the Cloud Run service is created.

In addition, the path parameter in the OpenAPI spec specifies the endpoint, or resource, supported by your API. You can specify an absolute path or one that uses path parameters:

Path Path with parameters
paths:
  /hello:
paths:
  /hello/{name}:
Generating the backend service URL from an API request

As API Gateway handles a request from the API client, it takes the request URL sent by the API client and translates it into the URL used to make the request to the backend service. Exactly how this translation occurs depends on which path translation strategy you are using.

The path_translation option to the x-google-backend extension supports two path translation strategies:

For example:

Setting path_translation

Set path_translation as part of setting x-google-backend:

x-google-backend:
  address: https://GCP_REGION-PROJECT_ID.cloudfunctions.net/hello
  path_translation: [ APPEND_PATH_TO_ADDRESS | CONSTANT_ADDRESS ]`

The default value of path_translation depends on where you set x-google-backend in your OpenAPI spec:

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-07 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["API clients can pass request headers, query parameters, form data, XML/JSON payloads, and request paths to the API Gateway."],["Backend services return response headers and XML/JSON payloads to the API client."],["The `x-google-backend` extension in the OpenAPI spec defines the backend service URL, with options to specify the address and path."],["API Gateway uses path translation strategies, either `APPEND_PATH_TO_ADDRESS` or `CONSTANT_ADDRESS`, to translate client request URLs into backend service URLs."],["The `path_translation` default value depends on where `x-google-backend` is used in the OpenAPI specification, being `APPEND_PATH_TO_ADDRESS` at the top level and `CONSTANT_ADDRESS` at the operation level."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4