Use GraphQL when a client needs selected fields from Cloud resources. Complete the Cloud quickstart first so VERYFRONT_API_KEY is available in your terminal.
Query projects
The projects field returns a connection object. Select project fields inside its data field:
query {
projects(input: { limit: 5 }) {
data {
id
slug
name
}
pageInfo {
hasNextPage
endCursor
}
}
}Send the query as JSON to the GraphQL endpoint:
curl --silent --show-error --fail-with-body \
https://api.veryfront.com/graphql \
-H "Authorization: Bearer $VERYFRONT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query":"query { projects(input: { limit: 5 }) { data { id slug name } pageInfo { hasNextPage endCursor } } }"}'Inspect data and errors
Read project records from data.projects.data. If data.projects.pageInfo.hasNextPage is true, pass endCursor as input.cursor in the next request.
Also check the top-level errors array. GraphQL can return errors alongside data, so an HTTP success status alone doesn't confirm the query succeeded.
A query such as projects { id } is invalid because id belongs to a project, not to the connection object. Use the Projects operation reference when checking the field signature.
Next
- GraphQL API: Explore queries and mutations.
- Authentication: Check credentials and project access.