Is there a way to get the complete URI of a request in Googles Endpoint API. one example will be is to get a similar url
有没有办法在Googles Endpoint API中获取请求的完整URI。一个例子是得到一个类似的网址
POST http://localhost:8080/_ah/api/package/v1.0/path1/path2
for now I'm just using the request object to pick some attributes it will be great if i can get the above url
现在我只是使用请求对象来选择一些属性,如果我能得到上面的网址将是很好的
1 个解决方案
#1
1
Google endpoints supports GET parameters.
Google端点支持GET参数。
Endpoints can use the path you specify including variables in the URL to perform actions. Parameters in your message types for GET requests to the server appear trailing in the URL as: PATH?PARAM=___
端点可以使用您指定的路径(包括URL中的变量)来执行操作。对服务器的GET请求的消息类型中的参数在URL中显示为:PATH?PARAM = ___
Endpoints also lets you directly embed values directly into the paths and pick those out. Note that using POST instead of GET hides parameters from the URL. The following is from the tutorial and handles paths like hellogreeting/1234
or hellogreeting/678
.
端点还允许您直接将值嵌入到路径中并选择它们。请注意,使用POST而不是GET会隐藏URL中的参数。以下内容来自教程并处理hellogreeting / 1234或hellogreeting / 678等路径。
@endpoints.method(MULTIPLY_METHOD_RESOURCE, Greeting,
path='hellogreeting/{times}', http_method='POST',
name='greetings.multiply')
def greetings_multiply(self, request):
return Greeting(message=request.message * request.times)
The actual URL queried would look fully like: somehost:9080/_ah/api/helloworld/v1/hellogreeting/1234
.
查询的实际URL看起来完全像:somehost:9080 / _ah / api / helloworld / v1 / hellogreeting / 1234。
#1
1
Google endpoints supports GET parameters.
Google端点支持GET参数。
Endpoints can use the path you specify including variables in the URL to perform actions. Parameters in your message types for GET requests to the server appear trailing in the URL as: PATH?PARAM=___
端点可以使用您指定的路径(包括URL中的变量)来执行操作。对服务器的GET请求的消息类型中的参数在URL中显示为:PATH?PARAM = ___
Endpoints also lets you directly embed values directly into the paths and pick those out. Note that using POST instead of GET hides parameters from the URL. The following is from the tutorial and handles paths like hellogreeting/1234
or hellogreeting/678
.
端点还允许您直接将值嵌入到路径中并选择它们。请注意,使用POST而不是GET会隐藏URL中的参数。以下内容来自教程并处理hellogreeting / 1234或hellogreeting / 678等路径。
@endpoints.method(MULTIPLY_METHOD_RESOURCE, Greeting,
path='hellogreeting/{times}', http_method='POST',
name='greetings.multiply')
def greetings_multiply(self, request):
return Greeting(message=request.message * request.times)
The actual URL queried would look fully like: somehost:9080/_ah/api/helloworld/v1/hellogreeting/1234
.
查询的实际URL看起来完全像:somehost:9080 / _ah / api / helloworld / v1 / hellogreeting / 1234。