General help
For generated documentation on what objects and fields are available, you can access the GraphQL Docs
tab in the GraphQL Playground, either locally (http://localhost:8081/graphql) or on dev (https://devproposal.facilities.rl.ac.uk/graphql).
Get all proposals in a call
Pass in a filter to the proposals query:
{ proposals(filter: { callId: 1}) { proposals { # Proposal[] status } } }
Get the questions of a proposal
From the questionary of a proposal, you can get a list of answers for each step (topic).
Note that while the proposal basis (title and abstract), sample, and sub template (generic template) questions are included in this list, their answers are not accessible through the value.
{ proposal(primaryKey: 1) { questionary { steps { fields { # Answer[] question { question # The question title id naturalKey dataType } value # The answer for most question types } } } } }
Get the title and abstract of a proposal
The title and abstract answers aren't accessible through the questionary of a proposal, so query them on a proposal.
{ proposal(primaryKey: 1) { title abstract } }
Get the generic template answers and samples of a proposal
You can look at the generic templates or sample fields of a proposal, and then get the question data from the questionary.
Note that this will show all generic templates and samples within the proposal (i.e. potentially answers to more than one question). If you use this in combination with Get the questions of a proposal, you can cross check the naturalKey or id.
{ proposal(primaryKey: 43) { samples { questionary { steps { fields { question { question # The question id naturalKey } value # The answer } } } } genericTemplates { questionary { steps { fields { question { question # The question id naturalKey } value # The answer } } } } } }
Example query to get proposals and all of their questions from a call
{ proposals(filter: { callId: 1}) { proposals { title abstract questionary { # Excludes sample, proposal basis and sub template answers steps { fields { question { question # The question } value # The answer } } } genericTemplates { questionary { steps { fields { question { id naturalKey question # The question } value # The answer } } } } samples { questionary { steps { fields { question { id naturalKey question # The question } value # The answer } } } } } } }