horizon icon indicating copy to clipboard operation
horizon copied to clipboard

Create options for basic REST endpoints for data ingress / webhooks

Open dalanmiller opened this issue 8 years ago • 11 comments

Similar to https://www.firebase.com/docs/rest/guide/saving-data.html

Given a pre-existing database, Horizon should have a way to allow people to ingest large .json dumps into Horizon. I got this question a fair number of times at OSCON from people thinking about how to move their data into Horizon.

Currently, your best bet is to hope that your data is in a format which is usable by rethinkdb import and then ingesting data that way. But this assumes you have experience with RethinkDB or are comfortable performing these kind of operations. Even thought it will definitely take longer for large datasets, making HTTP requests is definitely much simpler and easier for the smaller transferrals of application datasets.

It would be helpful to enable some sort of basic REST API:

hz serve --rest

POST
https://localhost:8181/horizon/rest/[table_name]

GET, PUT
https://localhost:8181/horizon/rest/[table_name]/[primary_id]

This would also help for people who have incoming data from other services and just need an endpoint to point some sort of webhook towards. In this case, origin domains could be whitelisted or some sort of access token could be provided as a query param (given TLS).

dalanmiller avatar May 25 '16 20:05 dalanmiller

+1 - this should be a first class usecase

antani avatar May 27 '16 03:05 antani

+1 https://www.bountysource.com/issues/34578040-create-options-for-basic-rest-endpoints-for-data-ingress-webhooks

marcus7777 avatar May 27 '16 09:05 marcus7777

This would enable me to get started with Horizon as I have a a possessive web app it doesn't assume good connectivity. So it will start with rest and work it's way up to real time. What can I do to help get this started?

marcus7777 avatar May 27 '16 09:05 marcus7777

+1

sylvainlap avatar Jul 26 '16 12:07 sylvainlap

Hey @marcus7777 @sylvainlap, when we release our Plugins (#588) implementation, this will issue will be easy to fix and also very customizable to your needs. Hold on tight.

dalanmiller avatar Jul 26 '16 17:07 dalanmiller

+1

maoycn avatar Jul 28 '16 13:07 maoycn

As a work around for data ingress, I opened an endpoint on my current server and used r.http from the Rethink Admin Console to ingest the data dump.

LawJolla avatar Jul 28 '16 17:07 LawJolla

+1 for REST transport on Horizon services. Since rethinkdb users/permissions are different than horizon users/permissions, if I want to user Horizon for my webapp then my "sources of truth" for security is Horizon. Goodbye ReQL... :(

Possibly some sort of http://feathersjs.com/ integration might work well e.g. feathers-horizon...

I took a crack at an example showing how to run the horizon client on the server side in Express and mapping REST CRUD endpoints. Still needs a lot of work, but just fishing for direction right now.

https://github.com/ubergarm/stack-in-a-box

ubergarm avatar Jul 31 '16 17:07 ubergarm

Talking with @segphault yesterday, it probably makes sense to make a plugin for basejump, since a lot of this stuff has been hammered out already very thoughtfully.

deontologician avatar Aug 31 '16 16:08 deontologician

basejump? link please :)

marcus7777 avatar Sep 01 '16 07:09 marcus7777

@marcus7777 the github repo is here, but there isn't much documentation yet: https://github.com/segphault/basejump-router For more details, you can check out the YouTube video of a presentation where I demoed an early version of it: https://www.youtube.com/watch?v=UxFgkCUiRAI

segphault avatar Sep 13 '16 18:09 segphault