yorkie-team/yorkie

Add API for Retrieving All Documents

Closed this issue · 9 comments

Description:

Proposing the addition of a REST API to retrieve the contents of Yorkie Documents, enabling developers using Yorkie to utilize the data.

Why:

During the operation of our service, the need for data analysis, such as inspecting accumulated data in Yorkie Documents, has arisen.

Currently, there is an GetDocumentSummary() admin gRPC API for getting a snapshot of a document.
Are you suggesting an HTTP REST API in JSON format to get document snapshots?

Exactly. I think I need an HTTP REST API. The service data is needed more for data analysis rather than in real-time, and gRPC has significant technical overhead.

@krapie I remember connect-rpc also exposing the APIs in HTTP as well as gRPC. Am I right?

@hackerwins Yes, connect-rpc also exposes plain HTTP along with gRPC. I think we can also resolve this issue when we switch current server rpc to connect-rpc.

Great. We will soon be using Secret Key for the Admin API too.
Screenshot 2023-11-17 at 2 25 53 PM

I have confirmed that we can use ConnectRPC to retrieve document with HTTP POST

Screenshot 2023-11-27 at 3 44 05 PM

Very excited to see this working :)

After migrating to Connect RPC, we can use REST API.

I think this issue could be solved by using the Private Key created in the Dashboard during the authentication step.

func VerifyAccess(ctx context.Context, be *backend.Backend, accessInfo *types.AccessInfo) error {
md := metadata.From(ctx)
project := projects.From(ctx)
if !project.RequireAuth(accessInfo.Method) {
return nil
}
return verifyAccess(
ctx,
be,
project.AuthWebhookURL,
md.Authorization,
accessInfo,
)
}

Then, is it possible to provide API for other features? (Document Editing, ...)

Then, is it possible to provide API for other features? (Document Editing, ...)

It would be better to deal with this as a separate issue.