How does OneGraph work?
OneGraph exposes a single GraphQL endpoint for you to dynamically query, at https://serve.onegraph.com/graphql
. To make a request, you'll include two things:
- An
app_id
query parameter to identify your app - A body in JSON with a GraphQL query and (optionally) some variables
The simplest curl command might look like the query below
curl 'https://serve.onegraph.com/graphql?app_id=0b33e830-7cde-4b90-ad7e-2a39c57c0e11' \
--data '{"query":"{ me { oneGraph { fullName email }}}"}'
That's simply saying, "I'm making a GraphQL request on behalf of app-id 0b33, and I want the following data:"
{
me {
oneGraph {
fullName
email
}
}
}
Incidentally, this is the query we're using right now on the site to tell if you're logged in. If you run the above curl
example, you should see:
{"data":{"me":{"oneGraph":null}}}
This is great, it just means that the query returned successfully, and that the curl command wasn't logged in as anyone (we'll get into authentication a bit later). You just made your first unauthenticated query. To make an authenticated query, you'll first need to make your own app!