Accessing ROS via GraphQL in Java


#1

Hello everyone. This post is not related to Android development. I’m a spring developer. I’m new to Realm Database and I need to create a crud web service (Not an android app just to be clear). I am a Java developer. From what I’ve gathered so far, I cannot connect directly to the Realm Object server to do database operations, rather would need to do that with the help of a POST API that takes graphql as an input. Can anyone help me start as to what service is that and how exactly this whole situation works.


#2

The API is documented roughly here: https://docs.realm.io/sync/graphql-web-access/how-to-use-the-api.

We also have a reference javascript client implementation here: https://github.com/realm/realm-graphql (it mostly handles the token refreshes).

That being said, the GraphQL API is designed to complement the mobile native API - e.g. it doesn’t offer API to create/modify the schema of the Realm files. You can do that via Studio, but it’s a bit unusual use case to use just the graphql interface without a native mobile client.


#3

@nirinchev Actually the realm db will sync up with its mobile components. For my use, i need to populate that db first so that the mobile segments can fetch from there. How else do we do that if not this way?


#4

If it’s a one-time population, you can do it with a server-side application - we currently support only C# and javascript as server-side languages, so you may need to get your hands dirty with non-Java code, but if it’s something relatively simple, such as copying data from one system to another, I imagine it shouldn’t be too hard to write. Of course, you can also use the GraphQL API, but then you need to first create the schema of the Realm via Studio, which may be a bit annoying. We do have plans to expose schema manipulation API via GraphQL but haven’t gotten around to it.