The quick start guide provides information and examples for getting started with the Vodori API GraphQL interface. Full API documentation can be accessed at Vodori API Technical Specification.
Please visit How to register a new application with the Vodori API in order to register your application with the Vodori API.
How it works
1. The requesting application authenticates with the Auth0 Authorization Server using its Client ID and Client Secret. The same endpoint is used for prod and sandbox tenants.
- Endpoint: https://prod-vodori-api.us.auth0.com/oauth/token
- Audience: https://apis.vodori.com
2. The Auth0 Authorization Server validates the Client ID and Client Secret.
3. Auth0 Authorization Server responds with an access token.
- Access tokens are valid for 1 hour. Requesting applications should reuse the provided access token until it expires. Upon expiration, the requesting application may request a new access token from the Auth0 authorization server.
4. The requesting application uses the access token to request the customer-specific GraphQL schema.
https://apis.vodori.com/api/graphql
This step is optional and is typically only performed when consuming an update to the schema.
5. The consuming application constructs a valid GraphQL query and uses the access token to request data from the Vodori API.
https://apis.vodori.com/api/graphql
Authentication
Upon receiving your application credentials from Vodori, retrieve an access token by submitting a request to Auth0 using the cURL command below.
Request
curl --location --request POST 'https://prod-vodori-api..us.auth0.com/oauth/token' \
--header 'Content-Type: application/json' \
--data-raw '{"client_id":"YOUR_CLIENT_ID","client_secret":"YOUR_CLIENT_SECRET","audience":"https://apis.vodori.com","grant_type":"client_credentials"}'Response
{"access_token":"YOUR_ACCESS_TOKEN","expires_in":3600,"token_type":"Bearer"}Note: The Vodori API does not support refresh tokens. Applications must retrieve a new access token from the OAuth token endpoint above after the current access token has expired.
Schema Retrieval
The Vodori API adheres to GraphQL standards to generate customer-specific schema. GraphQL Clients such as Altair can provide additional formatting, search, and query auto-generation functionality.
GraphQL Clients such as Apollo may require the API schema to be included in an application’s build process. These clients can then auto-generate code for use in the application based on the schema provided.
Customer-specific schema can be retrieved using the following cURL command.
Request
curl --request POST 'https://apis.vodori.com/api/graphql/schema' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN'Visit How to use customer-specific types with the Vodori API for more information regarding schema usage.
First Query
After receiving a valid access token, you're ready to execute your first query. The following cURL command can be used to query for all documents created after 2020-01-01T00:00:00Z.
Refer to the Vodori API Technical Specification for full details regarding the querying capabilities of the Vodori API.
Request
curl --request POST 'https://apis.vodori.com/api/graphql' \
-H 'content-type: application/json' \
-H 'authorization: Bearer YOUR_ACCESS_TOKEN' \
--data-raw '{"query":"query _GetDocuments($skip: Int, $limit: Int, $where: DocumentCollectionFilter) {\n documentCollection(\n skip: $skip\n limit: $limit\n where: $where\n sortBy: {sortableField: CREATED, orderDirection: ASC}\n ) {\n skip\n limit\n total\n nodes {\n sys {\n createdDate\n contentLength\n documentId\n mimeType\n url\n }\n fields {\n filename\n displayName\n kind\n expirationDate\n segment {\n id\n display\n }\n }\n }\n }\n}\n","variables":{"skip":0,"limit":1000,"where":{"sysFilter":{"createdDate_gt":"2021-01-01T00:00:00Z"}}}}'Same Request as a named query in Altair GraphQL client
Response
{
"data": {
"documentCollection": {
"skip": 0,
"limit": 1000,
"total": 1,
"nodes": [
{
"sys": {
"createdDate": "2021-01-21T20:31:03.040Z"
"contentLength": 105377,
"documentId": "VOD.531 FRA",
"mimeType": "application/pdf",
"url": null
},
"fields": {
"filename": "Venastor - One Pager B - v1.0.pdf",
"displayName": "Test Document 123",
"kind": "asset",
"expirationDate": "2022-01-09T06:01:00Z",
"segment": {
"FRA",
"France"
}
}
]
}
}
}
Comments
0 comments
Article is closed for comments.