shakirthow
shakirthow

Reputation: 1366

Get Request URI. Google Endpoints API

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

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

Upvotes: 0

Views: 814

Answers (1)

pyj
pyj

Reputation: 1499

Google endpoints supports GET parameters.

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=___

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.

@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.

Upvotes: 1

Related Questions