Description
The Key.toUrlSafe()
returns a URL encoded (similar to URLEncoder.encode
) version of the key like the one below:
partition_id+%7B%0A++project_id%3A+%22my-project%22%0A++namespace_id%3A+%22MyNamespace%22%0A%7D%0Apath+%7B%0A++kind%3A+%22MyEntity%22%0A++name%3A+%22MyKey%22%0A%7D%0A
The Google Cloud Datastore Console displays a Base64 encoded version of the key, which looks something like -
agVoZWxsb3IPCxIHQWNjb3VudBiZiwIM
The Console allows filtering on key by URL-safe key, which works fine if I use the URL-safe value displayed by the GCD Console, but does not work when using the value returned from Key.toUrlSafe()
.
The Console Documentation states that -
URL-safe key
This is a base64-encoded, serialized version of your entity key. The encoding method is available in any Cloud Datastore client library
Example: agVoZWxsb3IPCxIHQWNjb3VudBiZiwIM
So, the client libraries are expected to match with the Base64 version? Nonetheless, it would be nice to have the client libraries and Console in sync to help with crosschecking/debugging purposes.