I would like to query all entities in my fibery account dynamically (without providing the DB names, but rather extracting them from the schema). For this, I need to understand from the schema which types are user generated DBs and which types are internal/ system types.
I noticed there are many metadata flags returned, some of them are:
“fibery/domain?”
“fibery/platform?”
“fibery/secured?”
“fibery/entity-component?”
“fibery/schema-only?”
“fibery/type-component?”
“fibery/enum?”
Is it possible to have a quick description of what each of these fields mean?
Also is there is any recommendation on how to “understand” from the schema which types are user generated DBs?
We are creating an integration with Fibery, and want to query all entities generically in our system.
I have some follow up questions:
You mentioned using the domain flag leaves you with the user DB as well- if I wanted to filter this without hardcoding the user db name, would you say that filtering on the “platform” flag (fibery/platform? == false && fibery/domain? == true) would be sufficient (to only retrieve the space DBs)?
Is there any way to retrieve all the account’s space names, other than traversing the schema and filtering (in order to use with the GraphQL API that requires the space name as part of the URL path)?
Is there a way to retrieve full rich text fields content using the REST API entities query (without having to separately GET each rich text field using the document endpoint)? If not - is the only way to retrieve all rich documents content in a single request - to use the GraphQL API?
Is there a way to retrieve the total number of entities in a DB (asking both for REST and for GraphQL)?
Thank you so much, this is great info and very helpful!
2 more questions if that’s ok
Is there a way to retrieve the total number of entities in a DB (asking both for REST and for GraphQL)?
When trying to query graphQL for a space that has no DBs, I get a 500 error response with the following message: “There are no any databases for space [Getting Started]”. Introspection fails on this error. Is this a bug or the intended behaviour?
What is the nature of the query? I mean, why would you want to query a space that has no DBs?
I don’t believe it is possible, except by performing an unfiltered query and calculating the size of the returned array of entities.
What is the underlying need to know how many entities there are?
Our use case is roughly as follows:
We want to periodically query all user spaces for new entities (using GraphQL as it seems to fit our needs best), without assuming any prior knowledge of what spaces/ dbs exist.
When fetching all user spaces using your suggestion (using the entities query from apps), we also receive spaces that have no DBs (if they exist in the account).
Is there a way to know from metadata that a space has no DBs (so we can skip querying it)?
As for knowing the total number of entities- we’d like to track a percentage progress of our queries.
If you want to query all dbs, then there is no need to query all spaces, is there? Just check for domain dbs and query them directly.
Sounds intriguing. Where is the data ending up?
If you can’t make assumptions ahead of time about the schema, I’m curious to know what the downstream activities might be.
Is this because you are keeping track of the total number of entities in a db, and then using this number to decide if new entities have been added?
Overall, it does sound like you might be better served by using webhooks, to get notified of changes, and then update/maintain your webhooks as needed if the Fibery schema changes.
Can you suggest how to do that using GraphQL? Each space has its own graphQL endpoint, and to construct a graphQL query, introspection needs to be available- but it fails for spaces without DBs.
I’d be happy to elaborate in PM.
We have looked at webhooks as an option, but it does not answer our requirements.
Because of the issue I mentioned with fetching rich text fields as part of the same query. If I were to use REST API- I would need to parse the response, take all the document secrets, and query for those using the endpoint you mentioned, making the solution more complex than GraphQL which returns rich text fields as part of the same query.
I meant that you could use the REST API to get the complete list of Databases (including which Space they belong to) and then use this info in any way you like (including GraphQL queries to get the entities)