I am trying to pass attributes into an API call that are not contained in my EndpointsModel. For example, say I have the following model:
class MyModel(EndpointsModel):
attr1 = ndb.StringProperty()
Then assume I want to pass in attr2
as a parameter, but I don't want attr2
to be used as a filter nor do I want it to be stored in the model. I simply want to pass in some string, retrieve it inside of the method and use it to perform some business logic.
The documentation describes the query_fields
parameter for specifying the fields you want to pass into the method, but these appear to be coupled to the attributes contained inside the model, therefore you cannot pass in attributes that are not specified in the model.
Likewise, the documentation states that you can pass in attributes via the path variable:
@MyModel.method(request_fields=('id',),
path='mymodel/{id}', name='mymodel.get'
http_method='GET')
def MyModelGet(self, my_model):
# do something with id
But this requires you to change the URL, plus this appears to have the same constraint as query_fields
(the attribute must exist in the model).