Friday - last edited Friday
Hi everyone,
We're working on an integration with HOPEX via the GraphQL API, and we're currently facing an issue related to fetching a questionnaire used in an Execution Campaign.
What we're trying to do:
We aim to retrieve the full structure of a questionnaire, including:
- Direct questions attached to the questionnaireTemplate
-Questions within questionGroups linked to that template
Our current logic:
1- Resolve the used template for the questionnaire via its assessmentSession.
```graphql
query {
questionnaire {
id
name
assessmentSession {
questionnaireTemplate_UsedQuestionnaireTemplate {
id
name
}
}
}
}
```
2- Fetch direct questions and question groups from the template.
query GetTemplateDetails($templateId: String!) { questionnaireTemplate(filter: { id: $templateId }) { question_QuestionnaireElement { id name }}}
3- Fetch questions inside each group.
query GetGroupQuestions($groupId: String!) { questionGroup(filter: { id: $groupId }) { question { id name titleText }}}
The problem:
In the UI, we can see that the questionnaire template clearly contains questions, both direct and within groups. However, the GraphQL queries are returning:
question_QuestionnaireElement = []
questionGroup_QuestionnaireElement = [...] (groups are fetched)
But each group's question = []
Questions:
- Are we using the correct relationships/fields to fetch ( Direct questions from a questionnaireTemplate?/ Grouped questions from questionGroups?)
- Is there another relationship or query approach recommended by HOPEX for assessment use cases?
- Could session status, permissions, or any data visibility constraints be affecting what is returned by GraphQL?
-Is there an official recommended pattern to fully fetch the questionnaire structure used in assessments via API?