Validio API
The Validio API is built using GraphQL and enables interaction with the Validio platform via any GraphQL client.
GraphQL Basics
If you're unfamiliar with GraphQL, refer to our basic guide.
Validio GraphQL API Reference
All queries, mutations, and types available in our GraphQL API.
Base URL
The base URL is the URL you will use to access your Validio instance. The URL will usually take the following format: https://<my-company>.validio.io
Authentication
To authenticate your requests to the GraphQL API, you need to pass the Authorization
header. The header value should be of format <access-key>:<access-secret>
. Refer to Create API key on how to create credentials.
Recommendation
You can use environment variables to avoid storing credentials on disk. The variables to set are
VALIDIO_ENDPOINT
,VALIDIO_ACCESS_KEY
andVALIDIO_SECRET_ACCESS_KEY
.
Namespaces
Namespaces are used to separate between resources. This means that the resources you create in one namespace are only visible from that namespace. For example, you can use namespaces to:
- Separate Validators by team.
- Assign a unique namespace to resources you create using IaC, to prevent overwriting similar already existing resources.
Namespaces should be unique
We recommend that you explicitly assign a unique namespace to every project.
Note
A project's namespace is displayed in the
validio.json
file in the project directory.
Pagination and Filtering
Some API endpoints support input types that are used for pagination and filtering. They can be used to even further control what response you’ll get from the API. Not all queries support this, but you can see in the API specification which do. For more information, see the Validio GraphQL API Reference.
The filters work exactly like any other input type and can be specified as variable values. What values are expected can be found by referencing the API specification.
Pagination works in such a way that every query supporting this returns a PageInfo type. The start and end cursor are identifiers to where the returned dataset starts or ends. As long as the hasNextPage
is true there is more data to fetch. The next page can be fetched by passing a PaginationInput where the after value is set to the endCursor
from the last response.
Note
The pagination input type also has a field for limit which controls how many results each pages should contain. You can find an example on how to use pagination to iterate over multiple pages until all data is fetched in the Validio SDK Recipes.
Query Examples
By inspecting the GraphQL schema you can find the data you're interested in and how to get, create or update it. You can find common queries and how to use them in our Validio SDK Recipes.
Updated 2 months ago