Hello, hoping someone can fill in the missing gaps in my understanding of how to set up the REST interface in the Data area to connect to FaunaDB. FaunaDB is graphql API and I have spent many hours trying to get something to work at all. Wondering if it isn’t possible through Appgyver or what have whatnot.
I’m presuming it is my ignorance of most of the API REST vs GraphQL and lack of knowledge around formatting and content I need to put into Appgyver areas for the various REST (get, post, etc) to work with FaunaDB. (relative path, response key path, headers, parameters, etc). I have a secret/key I’m to use but unsure of where to use and how (encode in Base area or will that expose it publically, etc?). I have my FaunaDB setup, although I haven’t yet put any actual rows of data/documents in it yet but easily can if needed.
Let me try and explain some of terminology:
REST API = an API that implements REST (typically over the protocol HTTP)
JSON REST API = REST API that communicates in JSON payloads (other options are for example XML, HTML)
GraphQl = a query language for databases, in this case FaunaDB. The queries are not JSON, but the results are often returned as JSON documents.
In the case of AppGyver we support JSON over REST API for integrations. So to work with FaunaDB you’ll need to be able to send GraphQL queries as HTTP requests towards their endpoint.
FaunaDB documentation has some information on this in their documentation: https://docs.fauna.com/fauna/current/api/graphql/endpoints
in particular they reference this url https://graphql.org/learn/serving-over-http/
However depending on the case, this might not a very ergonomic/convenient way of doing things.
Another option is to build a REST API that interacts as a middleware layer between FaunaDB and applications such as AppGyver. An example of this approach can be found here: https://css-tricks.com/build-a-100-serverless-rest-api-with-firebase-functions-faunadb/
Hope this helps!
I appreciate the assistance. I’ve spent countless hours consuming all the information and even setting up the firebase app through the link you so kindly provided. I’m still unable to figure out how to set up and connect at all in the Data area in Appgyver. Are you saying I cannot connect in the Data area to a FaunaDB? They say you can connect but I have tried everything in the Base, Get, etc and am unable to get anything but a 400 error. I’d feel a lot better about going one way or another if I could get a connection made in appgyver so I can see how it really works in the UI, etc. (using the maybe not so ergonomic way in Appgyver or looking at separate API mgmt tool to connect rest and graphql). Can you help me with that structure in the Data tab? I’m not a programmer but an executive of healthcare companies… Thank you and any help is appreciated
Hi @Dan_McDermott, i don’t have much experience with GraphQL, but from what i’ve experienced with Appgyver so far, i think it’ll be a bit of a challenge to integrate a GraphQL API.
If you must really uses FaunaDB, then, like @Akseli_Virtanen suggested, maybe you could try out a middleware tool, e.g. n8n (workflow automation tool. You could send REST API requests to n8n and use their GraphQL node to convert your REST API request to a GraphQL API request.)
Otherwise, there are quite a few options these days for no-code/low-code, REST API including, databases/backends like, Firebase, Backendless, Back4App, Xano etc.
Hope this helps a bit.
What might help to understand the Data resource setup is that REST API requests are really just plain ordinary HTTP requests with an agreed upon format. The Data resources in Composer are a way of constructing and setting up these requests.
To stick with a very basic example, let’s take this placeholder API:
Like any REST url, you can visit this url in your browser and see the JSON data returned.
You can also configure this url endpoint to be used in Composer by using https://jsonplaceholder.typicode.com as the base url and
/posts as the GET RECORDS relative path.
We now have a series of videos uploaded on how to use data resources:
So I hope with this you can try and see how the Data resource configuration works
Regarding FaunaDB, the main way it is intended to be used is via the GraphQL API. As we currently don’t have a way to connect to a GraphQL API from Composer, this means we need a middle layer providing a REST API. This is what the Firebase tutorial is about, however this does require coding and is not trivial to do.
Building the necessary bridge from the FaunaDB GraphQL API to a REST API is probably going to require some development experience, but you do have some options. Also as @S_MittalM points out there are also various no-code/low-code solutions for databases/backends.
If you have some specific url endpoints you can share and need help with, I’m happy to help with those!