Twitterのようなマイクロブログアプリケーションをコーディングしようとしています。これを行うために、Google App EngineとDatatstoreを使用しています。NDBでPicklePropertyを照会する
私は2つのクラスを持っています。つぶやきのためのすべての受信機が含まれている子である
class Tweet(EndpointsModel):
_message_fields_schema = ('sender','body', 'name')
sender = ndb.StringProperty()
body = ndb.TextProperty()
created = ndb.DateTimeProperty(auto_now=True)
...
そしてTweetIndexクラス、親であるさえずるクラス。
class TweetIndex(EndpointsModel):
...
receivers = ndb.PickleProperty(indexed=True,repeated=True)
created = ndb.DateTimeProperty(auto_now=True)
...
@TweetIndex.method(request_fields=('receivers',),
path='mymodels', name='mymodel.list')
def MyModelList(self, query):
if not query.from_datastore:
raise endpoints.NotFoundException('MyModel not found.')
return query
私は目的が与えられたidが受信機の配列に含まれている場合TweetIndexエンティティを返すためにあるAPIメソッドMyModelListでTweetIndexエンティティを照会しようとしています。受信機の配列の
例:
データストアに次のようになります["13911772075915175317","1855429131779793831", ... ]
(BLOBとして格納):しかし
["gAJYEwAAADY1NjU2NDM3MzA1NDI2NDU5ODlxAS4=","gAJYEwAAADU4MDM3MjE4OTEyNDgzNzgyNjNxAS4=",...]
、以下のAPIリクエストを実行するときに:
POST https://myapi/.../v1/mymodels
{
"receivers": [
"13911772075915175317"
]
}
返される返信先:
404
- Show headers -
{
"error": {
"errors": [
{
"domain": "global",
"reason": "notFound",
"message": "MyModel not found."
}
],
"code": 404,
"message": "MyModel not found."
}
}
"13911772075915175317"は少なくとも受信機アレイに1回存在します。 私はまた、要求にブロブを入力しようとしましたが(驚きはありませんでしたが)どちらもうまくいきませんでした。
この配列を正しく照会する方法を教えてください。