Get Handbook Version
Get a single handbook version with full content. Use versionId: -1 to get the current/latest version.
Query
query GetHandbookVersion($handbookId: Int!, $versionId: Int!, $handbookType: String) {
getHandbookVersion(handbookId: $handbookId, versionId: $versionId, handbookType: $handbookType) {
id
handbookId
handbookType
content
createdAt
versionNumber
user {
id
name
email
avatarUrl
}
}
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
handbookId | Int! | Yes | The handbook ID |
versionId | Int! | Yes | The version ID to retrieve. Use -1 for the current version |
handbookType | String | No | Handbook type filter. Defaults to "comprehensive" |
Response
{
"data": {
"getHandbookVersion": {
"id": 42,
"handbookId": 123,
"handbookType": "comprehensive",
"content": "<html><head><title>Employee Handbook</title></head><body>...</body></html>",
"createdAt": "2025-03-10T08:00:00Z",
"versionNumber": 3,
"user": {
"id": "abc-123",
"name": "John Doe",
"email": "[email protected]",
"avatarUrl": null
}
}
}
}
Examples
Get Current Version
query {
getHandbookVersion(handbookId: 123, versionId: -1) {
id
content
versionNumber
createdAt
}
}
Get Specific Version
query {
getHandbookVersion(handbookId: 123, versionId: 42) {
id
content
versionNumber
createdAt
user {
name
}
}
}
With Variables
query GetVersion($handbookId: Int!, $versionId: Int!) {
getHandbookVersion(handbookId: $handbookId, versionId: $versionId) {
id
content
versionNumber
createdAt
}
}
Variables:
{
"handbookId": 123,
"versionId": 42
}
Response Fields
HandbookVersionDetail
| Field | Type | Description |
|---|---|---|
id | Int! | Version ID. -1 represents the current/latest version |
handbookId | Int! | Handbook ID this version belongs to |
handbookType | String! | Type of handbook (comprehensive or basic) |
content | String! | Full HTML content of this version |
createdAt | String! | ISO 8601 timestamp when this version was created |
versionNumber | Int! | Sequential version number |
user | HandbookVersionUser | User who created this version |
Error Responses
Version Not Found
{
"data": {
"getHandbookVersion": null
}
}
Access Denied
{
"errors": [
{
"message": "Handbook not found or access denied"
}
]
}
Notes
- Requires bearer token authentication
- User can only access versions for handbooks belonging to their account
- Use
versionId: -1to always get the current/latest content - Returns
nullif the version ID does not exist - The
contentfield contains the full HTML content of the handbook at that point in time