yorkie icon indicating copy to clipboard operation
yorkie copied to clipboard

Add API for Retrieving All Documents

Open devleejb opened this issue 1 year ago • 8 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.

devleejb avatar Nov 15 '23 11:11 devleejb

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?

krapie avatar Nov 16 '23 07:11 krapie

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.

devleejb avatar Nov 17 '23 04:11 devleejb

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

  • https://connectrpc.com/
  • https://github.com/yorkie-team/yorkie/issues/668

hackerwins avatar Nov 17 '23 05:11 hackerwins

@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.

krapie avatar Nov 17 '23 05:11 krapie

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

hackerwins avatar Nov 17 '23 05:11 hackerwins

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 :)

krapie avatar Nov 27 '23 06:11 krapie

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.

https://github.com/yorkie-team/yorkie/blob/258cb1e57bb1e6f2a3398ccd4459c96c60617838/server/rpc/auth/auth.go#L46-L61

hackerwins avatar Jan 03 '24 04:01 hackerwins

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

devleejb avatar Jan 04 '24 00:01 devleejb

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

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

hackerwins avatar Jul 04 '24 08:07 hackerwins