Hacker News new | ask | show | jobs
by thedangler 1289 days ago
So you're telling me I can use this to create my own wrapper to get data directly from another API?

I can now use this instead of creating my own workflow to get the data via an api which will be stored in the DB anyways?

1 comments

yes, that's correct. we've built a read-only version for Stripe (which is API-based), and we aim to have the read/write implementation done soon.

You will be able to do something like this:

    insert into stripe_products (name)
    values ('Pizza'), ('Pasta');
This will insert a value into Stripe via the API. Then you can query your stripe products like this:

    select *
    from stripe_products
    limit 10;
So I could implement one myself for arbitrary REST APIs?

I can't wait for somebody offering a generator, where you plug in your API, it pulls and parses the JSON, then you can select the fields you want and it generates the wrapper. (Alternatively, for put/post you could supply your own JSON).

Practically like some low/no code tools like Appsmith/Budibase and the likes already do today.

Sadly I lack the necessary skills and more important the time to dive into that.

Yes, I guess it would be possible to works with generic REST APIs - ones that all conform to a similar model.

> generator, where you plug in your API, it pulls and parses the JSON, then you can select the fields you want and it generates the wrapper

Probably on this one the wrapper could use an OpenAPI spec

Is there documentation on how to interact with a API for the wrapper? The API I'm probably going to try this with needs some crazy logic to parse the responses and does everything through query parameters.

Can't wait until this is ready.

You'd need to build a specific wrapper for that API. For example, here[0] is the wrapper for Stripe (docs[1])

I think you're looking for something more generic, like pg_net[2]. This would allow you to do your crazy logic by parsing your API response:

    select net.http_get('https://news.ycombinator.com') as request_id;

    select body, status_code from net.http_collect_response(1, async:=false);

[0] Stripe src: https://github.com/supabase/wrappers/tree/main/wrappers/src/...

[1] Stripe docs: https://supabase.github.io/wrappers/stripe/

[2] pg_net: https://supabase.github.io/pg_net/api/