Where to start a query
The entry points of the Elium API: me for the signed-in user, instance for the whole platform, and the objects you can load directly.
The Elium API has a GraphQL schema: the description of every type, field and argument it knows. (It is not the StorySchema type, which is a template.) This schema has hundreds of types, but you do not need to know them all. Almost every query starts from one of a few fields at the top of the schema, and from there you follow the links between objects. This page describes these starting points. For the full list of fields, see Read the schema documentation below.
The entry points
| Entry point | Use it to |
|---|---|
me | Work as the signed-in user: search, ask the AI, list their spaces, drafts and bookmarks. |
instance | Read or manage the platform as a whole: its members, teams, spaces and categories. |
story(slug:), space(slug:), user(slug:) | Load one story, space or user when you know its slug (a number). |
node(id:), nodes(ids:) | Load any object from its GraphQL ID. See GraphQL IDs and nodes. |
me: the signed-in user
me holds everything that depends on the user who authorised your app. It is the usual place to start, because it already applies that user's permissions. Some examples:
me.user: the user's own account.me.searchandme.answer: search the content, or ask the AI a question.me.spaces,me.drafts,me.bookmarks: the user's spaces, drafts and bookmarks.me.facetsandme.searchTags: the categories and tags the user can use.me.smartAssistantsandme.requests: the user's Smart Assistants and article requests.
instance: the platform
In the API, your Elium platform is called the instance. The instance field gives the settings and the content of the whole platform, not only what one user can see. Some examples:
instance.nameandinstance.baseUrl: the name and address of the platform.instance.usersandinstance.teams: every member and every team.instance.spacesandinstance.spaceGroups: every space and every space group.instance.allFacets: every category, with its tags.instance.smartAssistants: every Smart Assistant.
This query uses both entry points. It returns the name of the platform and the name of the signed-in user:
query {
instance {
name
}
me {
user {
name
}
}
}
The main objects
From these entry points, you reach the objects you work with. The product articles explain what each one is.
- Story: an article. See Stories, spaces and users.
- Space and space group: where stories live. See Types of spaces.
- User and team: the members of the platform, alone or in groups. See Manage teams.
- Facet and tag: in the API, a category is a facet, and it holds tags. See Tagging in Elium.
- Smart Assistant: an AI assistant that answers from a chosen set of content. See Smart Assistants.
- Request: a request for an article that is missing. See Article requests.
The same object is often reachable from several places. For example, you can load a space from space(slug:), me.spaces, instance.spaces or the space group that contains it. Choose the place that matches what you need: one known object, what the user sees, or the whole platform.
Read the schema documentation
The API describes itself. Your GraphQL client asks your platform for its schema (this is called introspection) and shows the documentation of every type, field and argument. It sends your access token, as for any other query. The schema it shows is always the current one.
- In Insomnia, click the schema button of a GraphQL request, as shown in Quick start.
- Any other GraphQL client that supports introspection works the same way. Give it the address
https://your-platform-name.elium.com/graphqland your access token.
The documentation helps you write your queries:
- Each field lists the arguments it accepts, with their type and default value. An argument whose type ends with
!and has no default value is required. - Each field also shows the type it returns. Open that type to see the fields you can ask for in the response.
- The description of each main type ends with a Found through list: the fields that return this type. Start your query from one of them.
- Deprecated fields are marked. Do not use them in new code. See Errors.