GraphQL Python Client
Client access to the ObjectBox GraphQL database server
Install the client
Install a GraphQL client like "python-graphql-client":
Run the ObjectBox server
Your ObjectBox Sync Server also comes with a native GraphQL server, making ObjectBox a GraphQL database that clients can query.
Note that the port used for GraphQL is different than the one used for Sync.
Get the session ID
In order to make GraphQL requests, you must first obtain a session ID.
Make an empty plain HTTP POST request to /api/v2/sessions
in order to receive a session ID. E.g. using the requests library:
GraphQL requests
Now everything is ready for you to do the GraphQL requests. Note that the session ID you found in the previous step must be passed to all GraphQL requests. You can provide it via e.g. using argparse. It's passed via the standard Authorization
header (see example below).
Here is a simple example of using the client to read all existing objects from the database.
Last updated