Accessing and Using Hasura Cloud for Vetspire GraphQL Exploration

Modified on Wed, Nov 20 at 5:44 PM


Purpose

This guide explains how to access the Hasura Cloud GraphiQL interface for exploring Vetspire's GraphQL API and provides examples and definitions for GraphQL operations: queries, mutations, and subscriptions. While this tool is useful for understanding Vetspire's API capabilities, it is important to note that Vetspire is not responsible for any misuse or data loss caused by user actions on this platform.


Why We Use This Tool

  1. GraphQL Schema Exploration:
    The tool provides an intuitive interface to explore Vetspire's API schema, fields, and relationships.

  2. Query Testing:
    Easily test GraphQL queries and mutations to ensure accuracy before implementing them in code or workflows.

  3. Efficient Debugging:
    Debug API requests in real-time, improving troubleshooting processes.

  4. User-Friendly Interface:
    Offers a structured view of the API with documentation readily available for quick reference.

  5. Supports Vetspire-Specific Workflows:
    Compatible with Vetspire's API, allowing seamless integration with internal and external applications.


Definitions: GraphQL Operations

1. Query

  • Purpose: Retrieve data from the GraphQL server. Queries are read-only operations that do not modify server data.
  • Behavior: Stateless and idempotent (running the same query multiple times produces the same result without altering data).
  • Example Use Case: Fetch a list of appointments updated within a certain time frame.

2. Mutation

  • Purpose: Modify or create data on the GraphQL server. Mutations are used for operations like creating, updating, or deleting records.
  • Behavior: Not idempotent (running the same mutation multiple times may yield different outcomes, e.g., creating duplicate entries).
  • Example Use Case: Add a new appointment to the system.

3. Subscription

  • Purpose: Receive real-time updates when data changes on the server. Subscriptions are ideal for live data updates like notifications or event tracking.
  • Behavior: Maintains an open connection (typically via WebSocket) to push updates to the client when relevant events occur.
  • Example Use Case: Get notified when appointments are updated in real-time.

How to Access and Use the Tool

  1. Visit the URL:
    Open the Hasura Cloud GraphiQL interface at Hasura Cloud GraphiQL.

  2. Review API Documentation:
    For additional guidance, visit the Vetspire Developer Documentation.

  3. Set Up API Key:
    If you need an API key, follow the instructions in the Vetspire API Key Creation Manual.

  4. Authenticate and Test Queries:

    • Enter your API key in the "Headers" section if required.
    • Use the query editor to write and test GraphQL queries, mutations, or subscriptions.
    • Click the "Run" button (triangle icon) to execute the query.
  5. Handle Data Responsibly:

    • Test queries in a sandbox environment before using them in production.
    • Avoid querying or exposing sensitive client or pet data unnecessarily.

GraphQL Operation Examples

Query

Retrieve appointment data updated between August 1, 2023, and September 30, 2023:

graphql
Copy code
query MyQuery { appointments(updatedAtStart: "2023-08-01T00:00:00", updatedAtEnd: "2023-09-30T00:00:00") { checkedInAt checkedOutAt completedAt } }

Mutation

Create a new appointment:

graphql
Copy code
mutation CreateAppointment($input: CreateAppointmentInput!) { createAppointment(input: $input) { id scheduledAt client { name } pet { name } } }

Variables:

json
Copy code
{ "input": { "scheduledAt": "2023-12-01T14:00:00", "clientId": "12345", "petId": "54321" } }

Subscription

Subscribe to appointment updates in real-time:

graphql
Copy code
subscription AppointmentUpdates { appointmentUpdated { id checkedInAt checkedOutAt completedAt } }

Disclaimer

Vetspire is not responsible for any data misuse, unauthorized access, or data loss resulting from improper use of this tool. Users are advised to exercise caution, adhere to data protection guidelines, and comply with all applicable policies when using Hasura Cloud.



Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article

https://support.vetspire.com/a/admin/portals/70000004548/themes