Exploring the Hierarchy Level API: A Complete Playground Journey
This guide provides a comprehensive walkthrough of the Hierarchy Level API using the GraphQL playground. Follow the structured approach to understand authentication, data querying, and operational procedures.Getting Started
Prerequisites
- Access to an Opigno Enterprise instance
- Valid API credentials (Client ID and Client Secret)
- GraphQL playground access (typically at
/graphql
endpoint)
Initial Setup
Before proceeding, you need to authenticate and understand the basic structure. The playground provides an interactive environment for testing queries and mutations in real-time.Step 1: Authentication
Authentication requires an access token. Configure the following headers in the playground:Replace
YOUR_ACCESS_TOKEN
with the token obtained from your OAuth2 flow, and YOUR_CLIENT_UUID
with your client identifier.Step 2: Exploring the Data Structure
Understanding Hierarchy Levels
Begin by exploring existing hierarchy levels in your system. This query provides an overview:Querying Specific Levels
Once you understand the structure, you can query specific levels:Step 3: Creating New Hierarchy Levels
Creating a Top-Level Structure
Create a new top-level hierarchy level:Top-level hierarchy levels do not require
parentId
specification. The system automatically sets this value to 0.Creating Sub-Levels
Create a sub-level under an existing hierarchy:Step 4: Modifying Existing Levels
Updating Labels
Modify the name of an existing hierarchy level:The update mutation implements partial update semantics. Only specified fields are updated; unspecified fields retain their current values.
Step 5: Managing Relationships
Assigning Users to Levels
Establish connections between user contexts and specific hierarchy levels:Assigning Trainings
Make trainings available to specific hierarchy levels:Assigning Taxonomy Terms
Apply taxonomy terms to hierarchy levels for categorization:Step 6: Cleaning Up
Removing Assignments
Remove existing relationships when necessary:Deleting Hierarchy Levels
Important: This operation permanently removes the hierarchy level and all associated data. Verify the target hierarchy level before proceeding.
Step 7: Advanced Operations
Complex Queries
Execute multiple operations in a single request:Batch Operations
Execute multiple mutations sequentially:Best Practices
Error Handling
Always check theerrors
field in mutation responses before proceeding with dependent operations. The API returns detailed error messages to help troubleshoot issues.
Query Optimization
Request only the fields you need. GraphQL allows you to specify exactly which fields to return, reducing payload size and improving performance.Testing Approach
Use the playground to test queries with sample data before implementing them in your application. This helps identify potential issues early in the development cycle.Next Steps
Now that you’re familiar with the Hierarchy Level API, you can:- Integrate these operations into your application
- Explore additional fields available in the schema
- Review the API reference documentation for complete field descriptions
- Learn about advanced filtering and pagination options