Getting Started
Your First Query
Make your first GraphQL query against the UDL server
The Version Query
Every UDL server includes a built-in version query. This is the simplest way to verify your server is running:
query {
version
}
This returns the current UDL version string.
Using cURL
Test the server from your terminal:
Terminal
curl http://localhost:4000/graphql \
-H "Content-Type: application/json" \
-d '{"query":"{ version }"}'
You should see a response like:
{
"data": {
"version": "1.0.0"
}
}
Using GraphiQL
For an interactive experience, open your browser to:
http://localhost:4000/graphiql
GraphiQL is a built-in IDE for exploring and testing GraphQL queries. Type the version query in the left panel and click the play button (or press Ctrl+Enter).
Understanding the Response
GraphQL responses always follow this structure:
{
"data": {
// Query results here
},
"errors": [
// Any errors here (only present if errors occurred)
]
}
The data field contains your query results, with keys matching your query field names. The errors field only appears when something goes wrong.
Next Steps
- Exploring GraphQL - Learn GraphQL basics with the GraphiQL IDE
- Using Plugins - Add data sources to your server