hasura - to call an http service api and insert the response into postgresql

136 views Asked by At

I've already made an action of type query that calls an http endpoint and return a list of results.

Then i should insert this resut into the postgresql (i suppose through a mutation). So, how can i join this insert mutation to the previus query result, and eventually apply some custom logic (eg: not insert the already present records)

1

There are 1 answers

0
moodgorning On

I was looking into this myself a couple of days ago, and my takeaway so far was that this is currently not possible. You would still have to write a small service (e.g. aws lambda) that calls your action and plugs the result into the mutation. That is also where you can apply your business logic. It would be a great feature to have, in order to connect two APIS directly together or even just do data transfers from one place to another. The new Rest transformers released in 2.1 at least make it easier and faster to integrate with existing APIs, so all you need to do is the plumbing now