graphql-engine/docs/graphql/manual/getting-started/first-graphql-query.rst

56 lines
1.1 KiB
ReStructuredText
Raw Normal View History

.. _first_graphql_query:
Making your first GraphQL query
===============================
.. contents:: Table of contents
:backlinks: none
:depth: 1
:local:
2019-09-11 10:17:14 +03:00
Let's create a sample table and query data from it using the Hasura console, a UI tool meant for doing exactly this:
Create a table
--------------
Head to the Hasura console, navigate to ``Data -> Create table`` and create a sample table called ``profile`` with
the following columns:
2019-02-06 09:39:36 +03:00
.. code-block:: sql
profile (
id INT PRIMARY KEY,
name TEXT
)
.. thumbnail:: ../../../img/graphql/manual/getting-started/create-profile-table.png
2019-02-06 09:39:36 +03:00
Now, insert some sample data into the table using the ``Insert Row`` tab of the ``profile`` table.
Try out a query
---------------
Head to the ``GraphiQL`` tab in the console and try running the following query:
.. code-block:: graphql
query {
profile {
id
name
}
}
You'll see that you get all the inserted data!
.. thumbnail:: ../../../img/graphql/manual/getting-started/profile-query.png
Next steps
----------
Read more about:
- :doc:`Building your schema <../schema/index>`
- :doc:`Queries <../queries/index>`