My entities can currently be viewed using the path /12345
where 12345 represents its entity ID
.
I want to create a handler which deletes any entity using /12345/delete
.
The handler would look something like this:
class DeleteHandler(BaseHandler):
def get(self, entity_id):
# cannot retrieve entity using just entity_id
# We cannot use KIND.get_by_id(entity_id), since 'entity kind' is unknown
How can we get the entity kind using the url, so that we may use get_by_id()
to retrieve the entity, and then delete it?
Am I approaching this correctly? Or is there a better way?
Entity ids are not unique across kinds, so I don't really know how you are expecting this to work.
The websafe encoded version of the full key, however, does give enough information to uniquely identify the entity. You can then use that to instantiate a key, and you can call delete on that key.