Skip to main content

Use your API

After sucessfully connecting Devii to your database tables, your API has been published and accessible to use. You can use the Devii Portal GraphiQL connection to test your queries. In the example below is a query of the charaters in the table "charaters" and the columns "id", "name" and "species" from the Star Wars franchise utilizing the built in GraphiQL IDE in Devii Portal.

GraphiQL Query

GraphQLJSON Response
query charaters {
characters {
id
name
species
}
}
{
"data": {
"characters": [
{
"id": "1",
"name": "Luke Skywalker",
"species": "Human"
}

Utilizing Devii Portal GraphiQL connection to mutate (change or update your database/table) to add a missing charater to the charater table in this case we will be using Variables to fill in the details to be added, the id will be auto incremented per the configuration of the underlying table. Upon successful execution of the mutation, the response from GraphiQL will include the id of the newly added character, providing confirmation of the operation's completion.

Portal Mutation

GraphQLJSON Response
mutation add_charater($i: charactersInput) {
create_characters(input: $i) {
id
}
}
variables
{
"i": {
"name": "Maz Kanata",
"height": 124,
"hair_color": "white",
"skin_color": "orange",
"eye_color": "brown",
"birth_year": 973,
"sex": "female",
"gender": "feminine",
"homeworld": "Tokdana",
"homeworld_id": 74,
"species": "unknown",
"species_id": 38
}
}
{
"data": {
"create_characters": {
"id": "106"
}
}
}