我有一个模型
class MyModel(EndpointsModel):
_message_fields_schema = ('entityKey', 'prop')
prop = ndb.StringProperty()
和一个 API 方法:
@MyModel.method(request_fields=('entityKey',),
path='mymodel/{entityKey}', http_method='GET', name='mymodel.get')
def mymodel_get(self, mymodel):
if not mymodel.from_datastore:
raise endpoints.NotFoundException('mymodel not found.')
return mymodel
但是当我尝试像这样的查询时
http://localhost:8080/_ah/api/myapi/v1/mymodel/adsfasf-cm9jay1zdG9wchELEgRBcmVhGICAgICAgIAJDA
我得到一个 404。我知道该对象存在,并且我知道那是正确的 urlsafe 键。这是怎么回事?当使用 'id' 而不是 'entityKey' 并使用整数键查询时,相同的代码也有效。